Class: OodCore::Job::Adapters::PBSPro::Batch Private
- Inherits:
-
Object
- Object
- OodCore::Job::Adapters::PBSPro::Batch
- Defined in:
- lib/ood_core/job/adapters/pbspro.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 PBS Pro batch server
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#bin_overrides ⇒ Object
readonly
private
Optional overrides for PBS Pro client executables.
-
#host ⇒ String?
readonly
private
The host of the PBS Pro batch server.
-
#pbs_exec ⇒ Pathname?
readonly
private
The path containing the PBS executables.
-
#strict_host_checking ⇒ Bool, true
readonly
private
Whether to use strict host checking when ssh to submit_host.
-
#submit_host ⇒ String?
readonly
private
The login node to submit the job via ssh.
Instance Method Summary collapse
-
#delete_job(id) ⇒ void
private
Delete a specified job from batch server.
-
#get_jobs(id: "") ⇒ 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(host: nil, submit_host: "", strict_host_checking: true, pbs_exec: nil, bin_overrides: {}) ⇒ Batch
constructor
private
A new instance of Batch.
-
#release_job(id) ⇒ void
private
Release a specified job that is on hold.
-
#select_jobs(args: []) ⇒ Array<String>
private
Select batch jobs from the batch server.
-
#submit_string(str, args: [], chdir: nil) ⇒ String
private
Submit a script expanded as a string to the batch server.
Constructor Details
#initialize(host: nil, submit_host: "", strict_host_checking: true, pbs_exec: nil, bin_overrides: {}) ⇒ 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.
80 81 82 83 84 85 86 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 80 def initialize(host: nil, submit_host: "", strict_host_checking: true, pbs_exec: nil, bin_overrides: {}) @host = host && host.to_s @submit_host = submit_host && submit_host.to_s @strict_host_checking = strict_host_checking @pbs_exec = pbs_exec && Pathname.new(pbs_exec.to_s) @bin_overrides = bin_overrides end |
Instance Attribute Details
#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 PBS Pro client executables
70 71 72 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 70 def bin_overrides @bin_overrides end |
#host ⇒ String? (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 host of the PBS Pro batch server
46 47 48 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 46 def host @host end |
#pbs_exec ⇒ 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 containing the PBS executables
64 65 66 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 64 def pbs_exec @pbs_exec end |
#strict_host_checking ⇒ Bool, true (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.
Whether to use strict host checking when ssh to submit_host
58 59 60 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 58 def strict_host_checking @strict_host_checking end |
#submit_host ⇒ String? (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 login node to submit the job via ssh
52 53 54 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 52 def submit_host @submit_host 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
162 163 164 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 162 def delete_job(id) call("qdel", id.to_s) end |
#get_jobs(id: "") ⇒ 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
108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 108 def get_jobs(id: "") args = ["-f", "-t"] # display all information args.concat [id.to_s] unless id.to_s.empty? lines = call("qstat", *args).gsub("\n\t", "").split("\n").map(&:strip) jobs = [] lines.each do |line| if /^Job Id: (?<job_id>.+)$/ =~ line jobs << { job_id: job_id } elsif /^(?<key>[^\s]+) = (?<value>.+)$/ =~ line hsh = jobs.last k1, k2 = key.split(".").map(&:to_sym) k2 ? ( hsh[k1] ||= {} and hsh[k1][k2] = value ) : ( hsh[k1] = value ) end end jobs 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
142 143 144 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 142 def hold_job(id) call("qhold", 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
152 153 154 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 152 def release_job(id) call("qrls", id.to_s) end |
#select_jobs(args: []) ⇒ Array<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.
Select batch jobs from the batch server
132 133 134 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 132 def select_jobs(args: []) call("qselect", *args).split("\n").map(&:strip) end |
#submit_string(str, args: [], chdir: nil) ⇒ 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
172 173 174 |
# File 'lib/ood_core/job/adapters/pbspro.rb', line 172 def submit_string(str, args: [], chdir: nil) call("qsub", *args, stdin: str.to_s, chdir: chdir).strip end |