Method: Xanthus::Job#execute

Defined in:
lib/xanthus/job.rb

#execute(config, iteration) ⇒ Object



103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# File 'lib/xanthus/job.rb', line 103

def execute config, iteration
  puts "Running job #{name.to_s}-#{iteration.to_s}..."
  FileUtils.mkdir_p 'tmp'
  Dir.chdir 'tmp' do
    self.host_scripts config
    @tasks.each do |machine, templates|
      self.setup_env machine, templates, config
    end
    self.execute_pre_instructions unless @pre_instructions.nil?
    @tasks.each do |machine, templates|
      self.run machine
    end
    self.execute_post_instructions unless @post_instructions.nil?
    @tasks.each do |machine, templates|
      self.halt machine
    end
    @tasks.each do |machine, templates|
      self.destroy machine
    end
  end
  system('mv', 'tmp', "#{name.to_s}-#{iteration.to_s}")
  system('tar', '-czvf', "#{name.to_s}-#{iteration.to_s}.tar.gz", "#{name.to_s}-#{iteration.to_s}")
  system('rm', '-rf', "#{name.to_s}-#{iteration.to_s}")
  config.github_conf.add("#{name.to_s}-#{iteration.to_s}.tar.gz") unless config.github_conf.nil?
  config.github_conf.push unless config.github_conf.nil?
  config.dataverse_conf.add("#{name.to_s}-#{iteration.to_s}.tar.gz") unless config.dataverse_conf.nil?
  puts "Job #{name.to_s}-#{iteration.to_s} done."
end