Class: QueuedJobList
- Defined in:
- lib/scbi_queue_system/queued_job_list.rb
Instance Attribute Summary
Attributes inherited from JobList
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize ⇒ QueuedJobList
constructor
A new instance of QueuedJobList.
Methods inherited from JobList
Constructor Details
#initialize ⇒ QueuedJobList
Returns a new instance of QueuedJobList.
6 7 8 9 10 |
# File 'lib/scbi_queue_system/queued_job_list.rb', line 6 def initialize super(QUEUED_PATH) end |
Class Method Details
.execute_job(job, machine) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/scbi_queue_system/queued_job_list.rb', line 12 def self.execute_job(job,machine) $LOG.info("Sending job #{job[:name]} to #{machine}") job_path=File.join(QUEUED_PATH,job[:name]) machine_path = File.join(SENT_PATH,machine) FileUtils.cp(job_path , File.join(RUNNING_PATH,machine)) FileUtils.mv(job_path , machine_path) # launch_cmd="ssh #{machine} \"bash #{File.join(machine_path,job[:name])}\"" output_file=File.join(job[:cwd],job[:name]+'.out') error_file=File.join(job[:cwd],job[:name]+'.error') # output_file=File.join('/tmp',job[:name]+'.out') # error_file=File.join('/tmp',job[:name]+'.error') copy_cmd = "scp #{File.join(machine_path,job[:name])} #{machine}:#{job[:cwd]}" if system(copy_cmd) # launch_cmd = "ssh #{machine} \"nohup bash < #{job[:script]} > #{output_file} 2> #{error_file} & \"" script_on_machine = File.join(job[:cwd],job[:name]) if machine.upcase.index('LOCALHOST') launch_cmd = "nohup #{script_on_machine} </dev/null > #{output_file} 2> #{error_file} &" else launch_cmd = "ssh #{machine} \"nohup #{script_on_machine} </dev/null > #{output_file} 2> #{error_file} &\"" end $LOG.info("Launch cmd: #{launch_cmd}") if system(launch_cmd) $LOG.info "LAUNCH DONE" else $LOG.error "LAUNCH FAILED: #{launch_cmd}" end else $LOG.error "SCP FAILED: #{copy_cmd}" end end |