qtoolkit.io.shell module#

class qtoolkit.io.shell.ShellIO(blocking=False, stdout_path='stdout', stderr_path='stderr')[source]#

Bases: BaseSchedulerIO

Construct the ShellIO object.

Parameters:
  • blocking (bool) – Whether the execution should be blocking.

  • stdout_path (str or Path) – Path to the standard output file.

  • stderr_path (str or Path) – Path to the standard error file.

CANCEL_CMD: str | None = 'kill -9'#
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 or Path) – Path of the script file to use.

header_template: str = '\nexec > $${qout_path}\nexec 2> $${qerr_path}\n\necho $${job_name}\n$${qverbatim}\n'#
parse_cancel_output(exit_code, stdout, stderr) CancelResult[source]#

Parse the output of the kill command.

parse_job_output(exit_code, stdout, stderr) QJob | None[source]#

Parse the output of the ps command and return the corresponding QJob object.

If the ps command returns multiple shell jobs, only the first corresponding QJob is returned. #TODO: should we check that there is only one job here ?

Parameters:
  • exit_code (int) – Exit code of the ps command.

  • stdout (str) – Standard output of the ps command.

  • stderr (str) – Standard error of the ps command.

parse_jobs_list_output(exit_code, stdout, stderr) list[QJob][source]#

Parse the output of the ps command to list jobs.

Parameters:
  • exit_code (int) – Exit code of the ps command.

  • stdout (str) – Standard output of the ps command.

  • stderr (str) – Standard error of the ps command.

parse_submit_output(exit_code, stdout, stderr) SubmissionResult[source]#
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.shell.ShellState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: QSubState

DEAD = 'X'#
DEFUNCT = 'Z'#
INTERRUPTIBLE_SLEEP = 'S'#
PAGING = 'W'#
RUNNING = 'R'#
STOPPED = 'T'#
STOPPED_DEBUGGER = 't'#
UNINTERRUPTIBLE_SLEEP = 'D'#
property qstate: QState#