Class: OodCore::Job::Adapters::Coder
- Inherits:
-
OodCore::Job::Adapter
- Object
- OodCore::Job::Adapter
- OodCore::Job::Adapters::Coder
- Defined in:
- lib/ood_core/job/adapters/coder.rb
Overview
The adapter class for Kubernetes.
Defined Under Namespace
Classes: Batch, CoderJobInfo
Instance Attribute Summary collapse
-
#batch ⇒ Object
readonly
Returns the value of attribute batch.
Instance Method Summary collapse
-
#delete(id) ⇒ void
Delete the submitted job.
-
#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.
-
#initialize(batch) ⇒ Coder
constructor
A new instance of Coder.
-
#status(id) ⇒ Status
abstract
Retrieve job status from resource manager.
-
#submit(script, after: [], afterok: [], afternotok: [], afterany: []) ⇒ String
Submit a job with the attributes defined in the job template instance.
-
#supports_job_arrays? ⇒ Boolean
Whether the adapter supports job arrays.
Methods inherited from OodCore::Job::Adapter
#accounts, #cluster_info, #directive_prefix, #hold, #info_all_each, #info_historic, #info_where_owner, #info_where_owner_each, #job_name_illegal_chars, #nodes, #queues, #release, #sanitize_job_name
Constructor Details
#initialize(batch) ⇒ Coder
Returns a new instance of Coder.
30 31 32 |
# File 'lib/ood_core/job/adapters/coder.rb', line 30 def initialize(batch) @batch = batch end |
Instance Attribute Details
#batch ⇒ Object (readonly)
Returns the value of attribute batch.
29 30 31 |
# File 'lib/ood_core/job/adapters/coder.rb', line 29 def batch @batch end |
Instance Method Details
#delete(id) ⇒ void
This method returns an undefined value.
Delete the submitted job.
112 113 114 115 116 |
# File 'lib/ood_core/job/adapters/coder.rb', line 112 def delete(id) res = batch.delete(id) rescue Batch::Error => e raise JobAdapterError, e. end |
#info(id) ⇒ Info
Subclass is expected to implement #info
Retrieve job info from the resource manager
92 93 94 95 96 |
# File 'lib/ood_core/job/adapters/coder.rb', line 92 def info(id) batch.info(id.to_s) rescue Batch::Error => e raise JobAdapterError, e. end |
#info_all(attrs: nil) ⇒ Array<Info>
Subclass is expected to implement #info_all
Retrieve info for all jobs from the resource manager
73 74 75 76 77 78 |
# File 'lib/ood_core/job/adapters/coder.rb', line 73 def info_all(attrs: nil) # TODO - implement info all for namespaces? batch.method_missing(attrs: attrs) rescue Batch::Error => e raise JobAdapterError, e. 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
104 105 106 |
# File 'lib/ood_core/job/adapters/coder.rb', line 104 def status(id) info(id)["job"]["status"] end |
#submit(script, after: [], afterok: [], afternotok: [], afterany: []) ⇒ String
Submit a job with the attributes defined in the job template instance
55 56 57 58 59 60 |
# File 'lib/ood_core/job/adapters/coder.rb', line 55 def submit(script, after: [], afterok: [], afternotok: [], afterany: []) raise ArgumentError, 'Must specify the script' if script.nil? batch.submit(script) rescue Batch::Error => e raise JobAdapterError, e. end |
#supports_job_arrays? ⇒ Boolean
Whether the adapter supports job arrays
83 84 85 |
# File 'lib/ood_core/job/adapters/coder.rb', line 83 def supports_job_arrays? false end |