lib/osc/machete/torque_helper.rb in osc-machete-2.0.0.pre1 vs lib/osc/machete/torque_helper.rb in osc-machete-2.0.0.pre2

- old
+ new

@@ -6,15 +6,17 @@ # also helps to have these separate so we can use a mock shell for unit tests # # == FIXME: This contains no state whatsoever. It should probably be changed into a module. class OSC::Machete::TorqueHelper # FIXME: Use ood_cluster gem - PREFIX = '/usr/local/torque/default' + LIB = ENV['TORQUE_LIB'] || '/opt/torque/lib64' + BIN = ENV['TORQUE_BIN'] || '/opt/torque/bin' HOSTS = { 'oakley' => 'oak-batch.osc.edu', 'ruby' => 'ruby-batch.osc.edu', - 'quick' => 'quick-batch.osc.edu' + 'quick' => 'quick-batch.osc.edu', + 'owens' => 'owens-batch.ten.osc.edu' } # Alias to initialize a new object. def self.default self::new() @@ -62,11 +64,12 @@ # this is to obviate current torque filter defect in which # a script with PBS header set to specify oak-batch ends # isn't properly handled and the job gets limited to 4GB pbs = PBS::Batch.new( host: HOSTS.fetch( host || host_from_script_pbs_header(script) ), - prefix: PREFIX + lib: LIB, + bin: BIN ) headers = { depend: qsub_dependencies_header(depends_on) } headers.clear if headers[:depend].empty? @@ -114,11 +117,12 @@ # @return [Status] The job state def qstat(pbsid, host: nil) id = pbsid.to_s pbs = PBS::Batch.new( host: HOSTS.fetch( host || host_from_pbsid(id) ), - prefix: PREFIX + lib: LIB, + bin: BIN ) status = pbs.get_job(id, filters: [:job_state]) status_for_char status[id][:job_state][0] # get status from status char value rescue PBS::UnkjobidError @@ -132,11 +136,12 @@ # @return [nil] def qdel(pbsid, host: nil) id = pbsid.to_s pbs = PBS::Batch.new( host: HOSTS.fetch( host || host_from_pbsid(id) ), - prefix: PREFIX + lib: LIB, + bin: BIN ) pbs.delete_job(id) rescue PBS::UnkjobidError # Common use case where trying to delete a job that is no longer in the system. @@ -150,10 +155,12 @@ "oakley" elsif (File.open(script) { |f| f.read =~ /#PBS -q @ruby-batch/ }) "ruby" elsif (File.open(script) { |f| f.read =~ /#PBS -q @quick-batch/ }) "quick" + elsif (File.open(script) { |f| f.read =~ /#PBS -q @owens-batch/ }) + "owens" else "oakley" # DEFAULT end end @@ -163,9 +170,11 @@ "oakley" elsif (pbsid.to_s =~ /^\d+$/ ) "ruby" elsif (pbsid =~ /quick/ ) "quick" + elsif (pbsid =~ /owens/ ) + "owens" else "oakley" # DEFAULT end end end