clusterjob.backends.pbs module

PBS/TORQUE backend

class clusterjob.backends.pbs.PbsBackend[source]

Bases: clusterjob.backends.ClusterjobBackend

PBS/TORQUE Backend

Attributes:
  • name (str) – Name of the backend
  • extension (str) – Extension for job scripts
  • prefix (str) – The prefix for every line in the resource header
  • status_mapping (dict) – map single-letter PBS status codes to clusterjob integer status codes.
  • resource_replacements (dict) – mapping of the common clusterjob resource keys to command line options of the qsub command.
  • job_vars (dict) – mapping of core environment variables to PBS-specific environment variables.
name = 'pbs'
extension = 'pbs'
prefix = '#PBS'
cmd_submit(jobscript)[source]

Given a JobScript instance, return a qsub command that submits the job to the scheduler, as a list of program arguments.

get_job_id(response)[source]

Given the stdout from the command returned by cmd_submit(), return a job ID

cmd_status(run, finished=False)[source]

Given a AsyncResult instance, return a qstat command that queries the scheduler for the job status. It is assumed that by passing -x to qstat, results for both running and finished jobs can be obtained.

get_status(response, finished=False)[source]

Given the stdout from the command returned by cmd_status(), return one of the status code defined in clusterjob.status, or None if the status cannot be determined

cmd_cancel(run)[source]

Given a AsyncResult instance, return a qdel command that cancels the run, as a list of command arguments.

resource_headers(jobscript)[source]

Given a JobScript instance, return a list of lines that encode the resource requirements, to be added at the top of the rendered job script

replace_body_vars(body)[source]

Given a multiline string that is the body of the job script, replace the placeholders for environment variables with backend-specific realizations, and return the modified body. See the job_vars attribute for the mappings that are performed.