Class: OodCore::Job::Adapters::PSIJ::Batch
- Inherits:
-
Object
- Object
- OodCore::Job::Adapters::PSIJ::Batch
- Defined in:
- lib/ood_core/job/adapters/psij.rb
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#bin ⇒ Object
readonly
Returns the value of attribute bin.
-
#bin_overrides ⇒ Object
readonly
Returns the value of attribute bin_overrides.
-
#cluster ⇒ Object
readonly
Returns the value of attribute cluster.
-
#conf ⇒ Object
readonly
Returns the value of attribute conf.
-
#executor ⇒ Object
readonly
Returns the value of attribute executor.
-
#queue_name ⇒ Object
readonly
Returns the value of attribute queue_name.
-
#strict_host_checking ⇒ Object
readonly
Returns the value of attribute strict_host_checking.
-
#submit_host ⇒ Object
readonly
Returns the value of attribute submit_host.
Instance Method Summary collapse
- #delete_job(args: []) ⇒ Object
- #get_jobs(id: "", owner: nil) ⇒ Object
- #hold_job(args: []) ⇒ Object
-
#initialize(cluster: nil, bin: nil, conf: nil, bin_overrides: {}, submit_host: "", strict_host_checking: true, executor: nil, queue_name: nil) ⇒ Batch
constructor
A new instance of Batch.
- #release_job(args: []) ⇒ Object
- #seconds_to_duration(time) ⇒ Object
- #submit_job_path(args: [], chdir: nil, stdin: nil) ⇒ Object
Constructor Details
#initialize(cluster: nil, bin: nil, conf: nil, bin_overrides: {}, submit_host: "", strict_host_checking: true, executor: nil, queue_name: nil) ⇒ Batch
Returns a new instance of Batch.
51 52 53 54 55 56 57 58 59 60 |
# File 'lib/ood_core/job/adapters/psij.rb', line 51 def initialize(cluster: nil, bin: nil, conf: nil, bin_overrides: {}, submit_host: "", strict_host_checking: true, executor: nil, queue_name: nil) @cluster = cluster && cluster.to_s @conf = conf && Pathname.new(conf.to_s) @bin = Pathname.new(bin.to_s) @bin_overrides = bin_overrides @submit_host = submit_host.to_s @strict_host_checking = strict_host_checking @executor = executor @queue_name = queue_name end |
Instance Attribute Details
#bin ⇒ Object (readonly)
Returns the value of attribute bin.
42 43 44 |
# File 'lib/ood_core/job/adapters/psij.rb', line 42 def bin @bin end |
#bin_overrides ⇒ Object (readonly)
Returns the value of attribute bin_overrides.
43 44 45 |
# File 'lib/ood_core/job/adapters/psij.rb', line 43 def bin_overrides @bin_overrides end |
#cluster ⇒ Object (readonly)
Returns the value of attribute cluster.
40 41 42 |
# File 'lib/ood_core/job/adapters/psij.rb', line 40 def cluster @cluster end |
#conf ⇒ Object (readonly)
Returns the value of attribute conf.
41 42 43 |
# File 'lib/ood_core/job/adapters/psij.rb', line 41 def conf @conf end |
#executor ⇒ Object (readonly)
Returns the value of attribute executor.
46 47 48 |
# File 'lib/ood_core/job/adapters/psij.rb', line 46 def executor @executor end |
#queue_name ⇒ Object (readonly)
Returns the value of attribute queue_name.
47 48 49 |
# File 'lib/ood_core/job/adapters/psij.rb', line 47 def queue_name @queue_name end |
#strict_host_checking ⇒ Object (readonly)
Returns the value of attribute strict_host_checking.
45 46 47 |
# File 'lib/ood_core/job/adapters/psij.rb', line 45 def strict_host_checking @strict_host_checking end |
#submit_host ⇒ Object (readonly)
Returns the value of attribute submit_host.
44 45 46 |
# File 'lib/ood_core/job/adapters/psij.rb', line 44 def submit_host @submit_host end |
Instance Method Details
#delete_job(args: []) ⇒ Object
80 81 82 83 84 85 |
# File 'lib/ood_core/job/adapters/psij.rb', line 80 def delete_job(args: []) delete_path = Pathname.new(__FILE__).dirname..join("psij/delete.py").to_s call("python3", delete_path, *args) rescue => e raise JobAdapterError, e end |
#get_jobs(id: "", owner: nil) ⇒ Object
62 63 64 65 66 67 68 69 70 71 72 73 |
# File 'lib/ood_core/job/adapters/psij.rb', line 62 def get_jobs(id: "", owner: nil) id = id.to_s.strip() params = { id: id, executor: executor, } args = params.map { |k, v| "--#{k}=#{v}" } get_info_path = Pathname.new(__FILE__).dirname..join("psij/get_info.py").to_s jobs_data = call("python3", get_info_path, *args) jobs_data = JSON.parse(jobs_data, symbolize_names: true) jobs_data end |
#hold_job(args: []) ⇒ Object
87 88 89 90 |
# File 'lib/ood_core/job/adapters/psij.rb', line 87 def hold_job(args: []) hold_path = Pathname.new(__FILE__).dirname..join("psij/hold.py").to_s call("python3", hold_path, *args) end |
#release_job(args: []) ⇒ Object
92 93 94 95 |
# File 'lib/ood_core/job/adapters/psij.rb', line 92 def release_job(args: []) release_path = Pathname.new(__FILE__).dirname..join("psij/release.py").to_s call("python3", release_path, *args) end |
#seconds_to_duration(time) ⇒ Object
97 98 99 |
# File 'lib/ood_core/job/adapters/psij.rb', line 97 def seconds_to_duration(time) "%02d:%02d:%02d" % [time/3600, time/60%60, time%60] end |
#submit_job_path(args: [], chdir: nil, stdin: nil) ⇒ Object
75 76 77 78 |
# File 'lib/ood_core/job/adapters/psij.rb', line 75 def submit_job_path(args: [], chdir: nil, stdin: nil) submit_path = Pathname.new(__FILE__).dirname..join("psij/submit.py").to_s call("python3", submit_path, *args, chdir: chdir, stdin: stdin) end |