buildtest.executors.cobalt
¶
This method implements CobaltExecutor class which is defines how cobalt executor submit job to Cobalt scheduler.
Module Contents¶
Classes¶
The CobaltExecutor class is responsible for submitting jobs to Cobalt Scheduler. |
|
The |
Attributes¶
- class buildtest.executors.cobalt.CobaltExecutor(name, settings, site_configs, max_pend_time=None)¶
Bases:
buildtest.executors.base.BaseExecutor
The CobaltExecutor class is responsible for submitting jobs to Cobalt Scheduler. The class implements the following methods:
load: load Cobalt executors from configuration file
dispatch: submit Cobalt job to scheduler
poll: poll Cobalt job via qstat and retrieve job state
gather: gather job record including output, error, exit code
- type = cobalt¶
- dispatch(self, builder)¶
This method is responsible for dispatching job to Cobalt Scheduler by invoking
builder.run()
which runs the build script. If job is submitted to scheduler, we get the JobID and pass this toCobaltJob
class. At job submission, cobalt will report the output and error file which can be retrieved using qstat. We retrieve the cobalt job record usingbuilder.job.gather()
.- Parameters
builder (BuilderBase, required) – builder object
- gather(self, builder)¶
This method is responsible for moving output and error file in the run directory. We need to read
<JOBID>.cobaltlog
file which contains output of exit code by performing a regular expression(exit code of.)(\d+)(\;)
. The cobalt log file will contain a line: task completed normally with an exit code of 0; initiating job cleanup and removal- Parameters
builder (BuilderBase, required) – builder object
- launcher_command(self)¶
- load(self)¶
Load the a Cobalt executor configuration from buildtest settings.
- poll(self, builder)¶
This method is responsible for polling Cobalt job by invoking the builder method
builder.job.poll()
. We check the job state and existence of output file. If file exists or job is complete, we gather the results and return from function. If job is pending we check if job time exceedsmax_pend_time
time limit and cancel job.- Parameters
builder (BuilderBase, required) – builder object
- class buildtest.executors.cobalt.CobaltJob(jobID)¶
Bases:
buildtest.executors.job.Job
The
CobaltJob
class performs operation on cobalt job upon job submission such as polling job, gather job record, cancel job. We also retrieve job state and determine if job is pending, running, complete, suspended.- cancel(self)¶
Cancel job by running
qdel <jobid>
. This method is called if job timer exceedsmax_pend_time
if job is pending.
- cobalt_log(self)¶
Return job cobalt.log file
- error_file(self)¶
Return job error file
- exitcode(self)¶
Return job exit code
- gather(self)¶
- Gather Job state by running qstat -lf <jobid> which retrieves all fields.
The output is in text format which is parsed into key/value pair and stored in a dictionary. This method will return a dict containing the job record
$ qstat -lf 347106 JobID: 347106 JobName : hold_job User : shahzebsiddiqui WallTime : 00:10:00 QueuedTime : 00:13:14 RunTime : N/A TimeRemaining : N/A
- is_cancelled(self)¶
Return
True
if job is cancelled otherwise returnsFalse
. Job state iscancelled
which is set by classcancel
method
- is_complete(self)¶
Return
True
if job is complete otherwise returnsFalse
. Cobalt job state for completed job job is marked asexiting
- is_pending(self)¶
Return
True
if job is pending otherwise returnsFalse
. When cobalt recieves job it is instarting
followed byqueued
state. We check if job is in either state.
- is_running(self)¶
Return
True
if job is running otherwise returnsFalse
. Cobalt job state for running job is is marked asrunning
- is_suspended(self)¶
Return
True
if job is suspended otherwise returnsFalse
. Cobalt job state for suspended is marked asuser_hold
- output_file(self)¶
Return job output file
- poll(self)¶
Poll job by running
qstat -l --header State <jobid>
which retrieves job state.
- buildtest.executors.cobalt.logger¶