Sha256: d0259b303a7f2ab6252a9b7456013c41ddacd1b2b4b60f79cafc13548cd2c8ea
Contents?: true
Size: 1.29 KB
Versions: 2
Compression:
Stored size: 1.29 KB
Contents
require 'rjobs/command_builder' require 'rjobs/process' require 'rjobs/job' module Rjobs class JobHandler @@host = "127.0.0.1" @@password = "xgrid" def self.get_job_attributes(id) cb = Rjobs::CommandBuilder.new("xgrid", { :h => @@host, :p => @@password, :f => "xml", :job => :attributes, :id => id }) # puts cb.build Rjobs::Process.run(cb.build) end def self.submit_job(job) cb = Rjobs::CommandBuilder.new("xgrid", { :h => @@host, :p => @@password, :f => "xml", :job => :submit }) cmd = cb.build << " " << job.command result = Rjobs::Process.run(cmd) result = Plist::parse_xml(result) job.id = result['jobIdentifier'].nil? ? -1 : Integer(result['jobIdentifier']) end def self.get_job_results(job) params = { :h => @@host, :p => @@password, :f => "xml", :job => :results, :id => job.id } if job.status == "Finished" params[:so] = job.name+".out" else params[:se] = job.name+".err" end cb = Rjobs::CommandBuilder.new("xgrid", params) # puts cb.build Rjobs::Process.run(cb.build) end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
rjobs-0.2.0.alpha | lib/rjobs/job_handler.rb |
rjobs-0.1.0.alpha | lib/rjobs/job_handler.rb |