Class: OodCore::Job::Adapters::CCQ
- Inherits:
-
OodCore::Job::Adapter
- Object
- OodCore::Job::Adapter
- OodCore::Job::Adapters::CCQ
- Defined in:
- lib/ood_core/job/adapters/ccq.rb
Overview
The adapter class for the Cloudy Cluster product CCQ.
Instance Attribute Summary collapse
-
#bin ⇒ Object
readonly
Returns the value of attribute bin.
-
#bin_overrides ⇒ Object
readonly
Returns the value of attribute bin_overrides.
-
#cloud ⇒ Object
readonly
Returns the value of attribute cloud.
-
#image ⇒ Object
readonly
Returns the value of attribute image.
-
#jobid_regex ⇒ Object
readonly
Returns the value of attribute jobid_regex.
-
#scheduler ⇒ Object
readonly
Returns the value of attribute scheduler.
Instance Method Summary collapse
-
#delete(id) ⇒ void
Delete the submitted job.
- #directive_prefix ⇒ Object
-
#hold(_) ⇒ void
This adapter does not implement hold and will always raise an exception.
-
#info(id) ⇒ Info
Retrieve job info from the resource manager.
-
#info_all(attrs: nil) ⇒ Array<Info>
Retrieve info for all jobs from the resource manager.
-
#initialize(config) ⇒ CCQ
constructor
A new instance of CCQ.
-
#release(_) ⇒ void
This adapter does not implement release and will always raise an exception.
-
#status(id) ⇒ Status
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.
Methods inherited from OodCore::Job::Adapter
#accounts, #cluster_info, #info_all_each, #info_where_owner, #info_where_owner_each, #job_name_illegal_chars, #nodes, #queues, #sanitize_job_name, #supports_job_arrays?
Constructor Details
#initialize(config) ⇒ CCQ
Returns a new instance of CCQ.
32 33 34 35 36 37 38 39 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 32 def initialize(config) @image = config.fetch(:image, nil) @cloud = config.fetch(:cloud, gcp_provider) @scheduler = config.fetch(:scheduler, nil) @bin = config.fetch(:bin, '/opt/CloudyCluster/srv/CCQ') @bin_overrides = config.fetch(:bin_overrides, {}) @jobid_regex = config.fetch(:jobid_regex, "job id is: (?<job_id>\\d+) you") end |
Instance Attribute Details
#bin ⇒ Object (readonly)
Returns the value of attribute bin.
30 31 32 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 30 def bin @bin end |
#bin_overrides ⇒ Object (readonly)
Returns the value of attribute bin_overrides.
30 31 32 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 30 def bin_overrides @bin_overrides end |
#cloud ⇒ Object (readonly)
Returns the value of attribute cloud.
30 31 32 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 30 def cloud @cloud end |
#image ⇒ Object (readonly)
Returns the value of attribute image.
30 31 32 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 30 def image @image end |
#jobid_regex ⇒ Object (readonly)
Returns the value of attribute jobid_regex.
30 31 32 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 30 def jobid_regex @jobid_regex end |
#scheduler ⇒ Object (readonly)
Returns the value of attribute scheduler.
30 31 32 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 30 def scheduler @scheduler end |
Instance Method Details
#delete(id) ⇒ void
This method returns an undefined value.
Delete the submitted job
127 128 129 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 127 def delete(id) call("ccqdel", args: [id]) end |
#directive_prefix ⇒ Object
131 132 133 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 131 def directive_prefix '#CC' end |
#hold(_) ⇒ void
This method returns an undefined value.
This adapter does not implement hold and will always raise
an exception.
111 112 113 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 111 def hold(_) raise NotImplementedError, "subclass did not define #hold" end |
#info(id) ⇒ Info
Retrieve job info from the resource manager
85 86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 85 def info(id) args = [] args.concat ["-s", scheduler] unless scheduler.nil? args.concat ["-ji", id] stat_output = call("ccqstat", args: args) # WARNING: code path differs here than info_all because the output # from ccqstat -ji $JOBID is much more data than just the 4 # columns that ccqstat gives. info_from_ccqstat_extended(stat_output) end |
#info_all(attrs: nil) ⇒ Array<Info>
Retrieve info for all jobs from the resource manager
74 75 76 77 78 79 80 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 74 def info_all(attrs: nil) args = [] args.concat ["-s", scheduler] unless scheduler.nil? stat_output = call("ccqstat", args: args) info_from_ccqstat(stat_output) end |
#release(_) ⇒ void
This method returns an undefined value.
This adapter does not implement release and will always raise
an exception.
120 121 122 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 120 def release(_) raise NotImplementedError, "subclass did not define #release" end |
#status(id) ⇒ Status
Retrieve job status from resource manager
102 103 104 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 102 def status(id) info(id).status end |
#submit(script, after: [], afterok: [], afternotok: [], afterany: []) ⇒ String
Submit a job with the attributes defined in the job template instance
51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 |
# File 'lib/ood_core/job/adapters/ccq.rb', line 51 def submit(script, after: [], afterok: [], afternotok: [], afterany: []) script_file = make_script_file(script.content) args = [] # cluster configuration args args.concat ["-s", scheduler] unless scheduler.nil? args.concat [image_arg, image] unless image.nil? args.concat ["-o", script.output_path.to_s] unless script.output_path.nil? args.concat ["-e", script.error_path.to_s] unless script.error_path.nil? args.concat ["-tl", seconds_to_duration(script.wall_time)] unless script.wall_time.nil? args.concat ["-js", script_file.path.to_s] args.concat script.native if script.native output = call("ccqsub", args: args) parse_job_id_from_ccqsub(output) ensure script_file.close end |