qtoolkit.io.base module#

class qtoolkit.io.base.BaseSchedulerIO[source]#

Bases: QTKObject, ABC

Base class for job queues.

CANCEL_CMD: str | None#
SUBMIT_CMD: str | None#
check_convert_qresources(resources: QResources) dict[source]#

Converts a Qresources instance to a dict that will be used to fill in the header of the submission script. Also checks that passed values are declared to be handled by the corresponding subclass.

generate_header(options: dict | QResources | None) str[source]#
generate_ids_list(jobs: list[QJob | int | str] | None) list[str][source]#
generate_run_commands(commands: list[str] | str) str[source]#
get_cancel_cmd(job: QJob | int | str) str[source]#

Get the command used to cancel a given job.

Parameters:

job ((str) job to be cancelled.)

get_job_cmd(job: QJob | int | str) str[source]#
get_jobs_list_cmd(jobs: list[QJob | int | str] | None, user: str | None) str[source]#
get_submission_script(commands: str | list[str], options: dict | QResources | None = None) str[source]#

Get the submission script for the given commands and options.

get_submit_cmd(script_file: str | Path | None = 'submit.script') str[source]#

Get the command used to submit a given script to the queue.

Parameters:

script_file ((str) path of the script file to use.)

header_template: str#
abstract parse_cancel_output(exit_code, stdout, stderr) CancelResult[source]#
abstract parse_job_output(exit_code, stdout, stderr) QJob | None[source]#
abstract parse_jobs_list_output(exit_code, stdout, stderr) list[QJob][source]#
abstract parse_submit_output(exit_code, stdout, stderr) SubmissionResult[source]#
shebang: str = '#!/bin/bash'#
property supported_qresources_keys: list#

List of attributes of QResources that are correctly handled by the _convert_qresources method. It is used to validate that the user does not pass an unsupported value, expecting to have an effect.

class qtoolkit.io.base.QTemplate(template)[source]#

Bases: Template

delimiter = '$$'#
get_identifiers() list[source]#

Returns a list of the valid identifiers in the template, in the order they first appear, ignoring any invalid identifiers. Imported from implementation in python 3.11 for backward compatibility.

pattern = re.compile('\n            \\$\\$(?:\n              (?P<escaped>\\$\\$)  |   # Escape sequence of two delimiters\n              (?P<named>(?a:[_a-z][_a-z0-9]*))       |   # delimiter and a Python identifier\n    , re.IGNORECASE|re.VERBOSE)#