Class: OodCore::Job::Adapters::Fujitsu_TCS::Batch Private
- Inherits:
-
Object
- Object
- OodCore::Job::Adapters::Fujitsu_TCS::Batch
- Defined in:
- lib/ood_core/job/adapters/fujitsu_tcs.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
Object used for simplified communication with a Fujitsu TCS batch server
Defined Under Namespace
Classes: Error, Fujitsu_TCS_TimeoutError
Instance Attribute Summary collapse
-
#bin ⇒ Pathname
readonly
private
The path to the Fujitsu TCS binaries.
-
#bin_overrides ⇒ Object
readonly
private
Optional overrides for Fujitsu TCS executables.
-
#working_dir ⇒ Object
readonly
private
Working directory for submitting a batch script.
Instance Method Summary collapse
-
#delete_job(id) ⇒ void
private
Delete a specified job from batch server.
-
#get_jobs(id: "", owner: nil) ⇒ Array<Hash>
private
Get a list of hashes detailing each of the jobs on the batch server.
-
#hold_job(id) ⇒ void
private
Put a specified job on hold.
-
#initialize(bin: nil, bin_overrides: {}, working_dir: nil) ⇒ Batch
constructor
private
A new instance of Batch.
-
#release_job(id) ⇒ void
private
Release a specified job that is on hold.
-
#submit_string(str, args: []) ⇒ String
private
Submit a script expanded as a string to the batch server.
Constructor Details
#initialize(bin: nil, bin_overrides: {}, working_dir: nil) ⇒ Batch
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Returns a new instance of Batch.
63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ood_core/job/adapters/fujitsu_tcs.rb', line 63 def initialize(bin: nil, bin_overrides: {}, working_dir: nil) @bin = Pathname.new(bin.to_s) @bin_overrides = bin_overrides if working_dir == nil @working_dir = Dir.pwd elsif working_dir == "HOME" @working_dir = Dir.home else raise(StandardError, "Unknown working_dir") end end |
Instance Attribute Details
#bin ⇒ Pathname (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
The path to the Fujitsu TCS binaries
40 41 42 |
# File 'lib/ood_core/job/adapters/fujitsu_tcs.rb', line 40 def bin @bin end |
#bin_overrides ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Optional overrides for Fujitsu TCS executables
46 47 48 |
# File 'lib/ood_core/job/adapters/fujitsu_tcs.rb', line 46 def bin_overrides @bin_overrides end |
#working_dir ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Working directory for submitting a batch script
51 52 53 |
# File 'lib/ood_core/job/adapters/fujitsu_tcs.rb', line 51 def working_dir @working_dir end |
Instance Method Details
#delete_job(id) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Delete a specified job from batch server
143 144 145 |
# File 'lib/ood_core/job/adapters/fujitsu_tcs.rb', line 143 def delete_job(id) call("pjdel", id.to_s) end |
#get_jobs(id: "", owner: nil) ⇒ Array<Hash>
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Get a list of hashes detailing each of the jobs on the batch server
96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 |
# File 'lib/ood_core/job/adapters/fujitsu_tcs.rb', line 96 def get_jobs(id: "", owner: nil) args = ["-A", "-s", "--data", "--choose=jid,jnam,rscg,st,std,stde,adt,sdt,nnumr,usr,elpl,elp"] args.concat ["--filter", "jid=" + id.to_s] unless id.to_s.empty? args.concat ["--filter", "usr=" + owner.to_s] unless owner.to_s.empty? StringIO.open(call("pjstat", *args)) do |output| output.gets() # Skip header jobs = [] output.each_line do |line| l = line.split(",") jobs << {:JOB_ID => l[1], :JOB_NAME => l[2], :RSC_GRP => l[3].split[0], :ST => l[4], :STD => l[5], :STDE => l[6], :ACCEPT => l[7], :START_DATE => l[8], :NODES => l[9].split(":")[0], :USER => l[10], :ELAPSE_LIM => l[11], :ELAPSE_TIM => l[12].split[0] } end jobs end rescue Fujitsu_TCS_TimeoutError return [{ JOB_ID: id, ST: 'undetermined' }] end |
#hold_job(id) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Put a specified job on hold
123 124 125 |
# File 'lib/ood_core/job/adapters/fujitsu_tcs.rb', line 123 def hold_job(id) call("pjhold", id.to_s) end |
#release_job(id) ⇒ void
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
This method returns an undefined value.
Release a specified job that is on hold
133 134 135 |
# File 'lib/ood_core/job/adapters/fujitsu_tcs.rb', line 133 def release_job(id) call("pjrls", id.to_s) end |
#submit_string(str, args: []) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Submit a script expanded as a string to the batch server
152 153 154 155 |
# File 'lib/ood_core/job/adapters/fujitsu_tcs.rb', line 152 def submit_string(str, args: []) args = args.map(&:to_s) call("pjsub", *args, stdin: str.to_s).split[5] end |