Class: OodCore::Job::Adapters::Flux::Batch Private
- Inherits:
-
Object
- Object
- OodCore::Job::Adapters::Flux::Batch
- Defined in:
- lib/ood_core/job/adapters/flux/batch.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 Flux: runs the flux CLI, locally or over ssh on a submit host, and parses its JSON.
Written in the compact form, like the LSF and SGE adapters' batch.rb, so this file never reopens class Flux. It is required from inside the Flux class body, after the class exists.
Defined Under Namespace
Classes: Error
Instance Attribute Summary collapse
-
#bin ⇒ Pathname?
readonly
private
The path to the Flux client installation binaries.
-
#bin_overrides ⇒ Object
readonly
private
Optional overrides for Flux client executables.
-
#flux_uri ⇒ String?
readonly
private
URI of the Flux instance, or nil for the system instance.
-
#strict_host_checking ⇒ Bool
readonly
private
Whether to use strict host checking when ssh to submit_host.
-
#submit_host ⇒ String
readonly
private
The login node where commands are run via ssh.
Instance Method Summary collapse
- #delete_job(id) ⇒ Object private
-
#get_job(id) ⇒ Hash
private
Get the json description of one job.
-
#get_jobs(owner: nil) ⇒ Array<Hash>
private
Get the json descriptions of active jobs.
- #hold_job(id) ⇒ Object private
-
#initialize(bin: nil, bin_overrides: {}, submit_host: "", strict_host_checking: true, flux_uri: nil) ⇒ Batch
constructor
private
A new instance of Batch.
- #release_job(id) ⇒ Object private
-
#submit_string(str, args: []) ⇒ String
private
Submit a batch script on stdin.
Constructor Details
#initialize(bin: nil, bin_overrides: {}, submit_host: "", strict_host_checking: true, flux_uri: 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.
40 41 42 43 44 45 46 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 40 def initialize(bin: nil, bin_overrides: {}, submit_host: "", strict_host_checking: true, flux_uri: nil) @bin = Pathname.new(bin.to_s) @bin_overrides = bin_overrides @submit_host = submit_host.to_s @strict_host_checking = strict_host_checking @flux_uri = flux_uri && flux_uri.to_s 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 Flux client installation binaries
16 17 18 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 16 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 Flux client executables
22 23 24 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 22 def bin_overrides @bin_overrides end |
#flux_uri ⇒ 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.
URI of the Flux instance, or nil for the system instance
34 35 36 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 34 def flux_uri @flux_uri end |
#strict_host_checking ⇒ Bool (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
30 31 32 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 30 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 where commands are run via ssh
26 27 28 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 26 def submit_host @submit_host end |
Instance Method Details
#delete_job(id) ⇒ Object
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.
82 83 84 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 82 def delete_job(id) call("cancel", id.to_s) end |
#get_job(id) ⇒ 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 the json description of one job
60 61 62 63 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 60 def get_job(id) out = call("jobs", "--json", id.to_s) parse_jobs(out).first end |
#get_jobs(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 the json descriptions of active jobs
68 69 70 71 72 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 68 def get_jobs(owner: nil) args = owner.nil? ? ["-A"] : ["-u", owner.to_s] out = call("jobs", "--json", *args) parse_jobs(out) end |
#hold_job(id) ⇒ Object
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.
74 75 76 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 74 def hold_job(id) call("job", "urgency", id.to_s, "hold") end |
#release_job(id) ⇒ Object
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.
78 79 80 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 78 def release_job(id) call("job", "urgency", id.to_s, "default") 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 batch script on stdin
52 53 54 55 |
# File 'lib/ood_core/job/adapters/flux/batch.rb', line 52 def submit_string(str, args: []) out = call("batch", *args, stdin: str.to_s) OodCore::Job::Adapters::Flux::JobId.to_decimal(out) end |