Skip to content

xqute.plugin

module

xqute.plugin

Hook specifications for scheduler plugins

Functions
function

xqute.plugin.on_init(xqute)

When xqute is initialized

Note that this hook will run at the same time when producer and consumer start. So they are not ensured to be started at this point.

Parameters
  • xqute (Xqute) The xqute object
function

xqute.plugin.on_shutdown(xqute, sig)

When xqute is shutting down

Return False to stop shutting down, but you have to shut it down by yourself, for example, xqute.task.cancel()

Only the first return value will be used.

Parameters
  • xqute (Xqute) The xqute object
  • sig (signal.signals | none) The signal. None means a natural shutdown
function

xqute.plugin.on_job_init(scheduler, job)

When the job is initialized

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_job_queued(scheduler, job)

When the job is queued

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_job_submitting(scheduler, job)

When the job is to be submitted

Return False to cancel submitting. Only the first return value is used.

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_job_submitted(scheduler, job)

When the job is submitted

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_job_started(scheduler, job)

When the job starts to run.

Note that this is not when exactly the job starts to run, but when the scheduler starts to wait for the job to finish. So this hook is not suitable for measuring the time of the job.

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_job_polling(scheduler, job)

When the system is polling job status

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_job_killing(scheduler, job)

When the job is being killed

Return False to stop killing the job.

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_job_killed(scheduler, job)

When the job is killed

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_job_failed(scheduler, job)

When the job is failed

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_job_succeeded(scheduler, job)

When the job is succeeded

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
function

xqute.plugin.on_jobcmd_init(scheduler, job)

When the job command wrapper script is initialized before the prescript is run

This should return a piece of bash code to be inserted in the wrapped job script (template), which is a python template string, with the following variables available: status and job. status is the class JobStatus from xqute.defaults.py and job is the Job instance.

For multiple plugins, the code will be inserted in the order of the plugin priority.

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
Returns (str)

The bash code to be inserted

function

xqute.plugin.on_jobcmd_prep(scheduler, job)

When the job command right about to be run

This should return a piece of bash code to be inserted in the wrapped job script (template), which is a python template string, with the following variables available: status and job. status is the class JobStatus from xqute.defaults.py and job is the Job instance.

The bash variable $cmd is accessible in the context. It is also possible to modify the cmd variable. Just remember to assign the modified value to cmd.

For multiple plugins, the code will be inserted in the order of the plugin priority. Keep in mind that the $cmd may be modified by other plugins.

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
Returns (str)

The bash code to be inserted

function

xqute.plugin.on_jobcmd_end(scheduler, job)

When the job command finishes and after the postscript is run

This should return a piece of bash code to be inserted in the wrapped job script (template), which is a python template string, with the following variables available: status and job. status is the class JobStatus from xqute.defaults.py and job is the Job instance.

The bash variable $rc is accessible in the context, which is the return code of the job command.

For multiple plugins, the code will be inserted in the order of the plugin priority.

Parameters
  • scheduler (Scheduler) The scheduler object
  • job (Job) The job object
Returns (str)

The bash code to be inserted