Class: OodCore::Job::Adapter Abstract
- Inherits:
-
Object
- Object
- OodCore::Job::Adapter
- Defined in:
- lib/ood_core/job/adapter.rb
Overview
A class that handles the communication with a resource manager for submitting/statusing/holding/deleting jobs
Direct Known Subclasses
OodCore::Job::Adapters::Lsf, OodCore::Job::Adapters::PBSPro, OodCore::Job::Adapters::Sge, OodCore::Job::Adapters::Slurm, OodCore::Job::Adapters::Torque
Instance Method Summary collapse
-
#delete(id) ⇒ void
abstract
Delete the submitted job.
-
#hold(id) ⇒ void
abstract
Put the submitted job on hold.
-
#info(id) ⇒ Info
abstract
Retrieve job info from the resource manager.
-
#info_all(attrs: nil) ⇒ Array<Info>
abstract
Retrieve info for all jobs from the resource manager.
-
#info_all_each(attrs: nil) {|Info| ... } ⇒ Enumerator
Iterate over each job Info object.
-
#info_where_owner(owner, attrs: nil) ⇒ Array<Info>
Retrieve info for all jobs for a given owner or owners from the resource manager.
-
#info_where_owner_each(owner, attrs: nil) {|Info| ... } ⇒ Enumerator
Iterate over each job Info object.
-
#release(id) ⇒ void
abstract
Release the job that is on hold.
-
#status(id) ⇒ Status
abstract
Retrieve job status from resource manager.
-
#submit(script, after: [], afterok: [], afternotok: [], afterany: []) ⇒ String
abstract
Submit a job with the attributes defined in the job template instance.
-
#supports_job_arrays? ⇒ Boolean
Whether the adapter supports job arrays.
Instance Method Details
#delete(id) ⇒ void
Subclass is expected to implement #delete
This method returns an undefined value.
Delete the submitted job
157 158 159 |
# File 'lib/ood_core/job/adapter.rb', line 157 def delete(id) raise NotImplementedError, "subclass did not define #delete" end |
#hold(id) ⇒ void
Subclass is expected to implement #hold
This method returns an undefined value.
Put the submitted job on hold
139 140 141 |
# File 'lib/ood_core/job/adapter.rb', line 139 def hold(id) raise NotImplementedError, "subclass did not define #hold" end |
#info(id) ⇒ Info
Subclass is expected to implement #info
Retrieve job info from the resource manager
120 121 122 |
# File 'lib/ood_core/job/adapter.rb', line 120 def info(id) raise NotImplementedError, "subclass did not define #info" end |
#info_all(attrs: nil) ⇒ Array<Info>
Subclass is expected to implement #info_all
Retrieve info for all jobs from the resource manager
47 48 49 |
# File 'lib/ood_core/job/adapter.rb', line 47 def info_all(attrs: nil) raise NotImplementedError, "subclass did not define #info_all" end |
#info_all_each(attrs: nil) {|Info| ... } ⇒ Enumerator
Iterate over each job Info object
81 82 83 84 85 86 87 |
# File 'lib/ood_core/job/adapter.rb', line 81 def info_all_each(attrs: nil) return to_enum(:info_all_each, attrs: attrs) unless block_given? info_all(attrs: attrs).each do |job| yield job end end |
#info_where_owner(owner, attrs: nil) ⇒ Array<Info>
Retrieve info for all jobs for a given owner or owners from the resource manager
62 63 64 65 66 67 68 69 |
# File 'lib/ood_core/job/adapter.rb', line 62 def info_where_owner(owner, attrs: nil) owner = Array.wrap(owner).map(&:to_s) # must at least have job_owner to filter by job_owner attrs = Array.wrap(attrs) | [:job_owner] unless attrs.nil? info_all(attrs: attrs).select { |info| owner.include? info.job_owner } end |
#info_where_owner_each(owner, attrs: nil) {|Info| ... } ⇒ Enumerator
Iterate over each job Info object
100 101 102 103 104 105 106 |
# File 'lib/ood_core/job/adapter.rb', line 100 def info_where_owner_each(owner, attrs: nil) return to_enum(:info_where_owner_each, owner, attrs: attrs) unless block_given? info_where_owner(owner, attrs: attrs).each do |job| yield job end end |
#release(id) ⇒ void
Subclass is expected to implement #release
This method returns an undefined value.
Release the job that is on hold
148 149 150 |
# File 'lib/ood_core/job/adapter.rb', line 148 def release(id) raise NotImplementedError, "subclass did not define #release" end |
#status(id) ⇒ Status
Subclass is expected to implement #status
Optimized slightly over retrieving complete job information from server
Retrieve job status from resource manager
130 131 132 |
# File 'lib/ood_core/job/adapter.rb', line 130 def status(id) raise NotImplementedError, "subclass did not define #status" end |
#submit(script, after: [], afterok: [], afternotok: [], afterany: []) ⇒ String
Subclass is expected to implement #submit
Submit a job with the attributes defined in the job template instance
32 33 34 |
# File 'lib/ood_core/job/adapter.rb', line 32 def submit(script, after: [], afterok: [], afternotok: [], afterany: []) raise NotImplementedError, "subclass did not define #submit" end |
#supports_job_arrays? ⇒ Boolean
Whether the adapter supports job arrays
111 112 113 |
# File 'lib/ood_core/job/adapter.rb', line 111 def supports_job_arrays? true end |