qtoolkit.core.data_objects module#

class qtoolkit.core.data_objects.CancelResult(job_id: 'int | str | None' = None, step_id: 'int | None' = None, exit_code: 'int | None' = None, stdout: 'str | None' = None, stderr: 'str | None' = None, status: 'CancelStatus | None' = None)[source]#

Bases: OperationResult

status: CancelStatus | None = None#

Status of the cancellation.

class qtoolkit.core.data_objects.CancelStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: QTKEnum

FAILED = 'FAILED'#
JOB_ID_UNKNOWN = 'JOB_ID_UNKNOWN'#
SUCCESSFUL = 'SUCCESSFUL'#
class qtoolkit.core.data_objects.OperationResult(job_id: 'int | str | None' = None, step_id: 'int | None' = None, exit_code: 'int | None' = None, stdout: 'str | None' = None, stderr: 'str | None' = None)[source]#

Bases: QTKObject

exit_code: int | None = None#

Exit code of the submitted job.

job_id: int | str | None = None#

Job ID of the submitted job.

stderr: str | None = None#

Standard error of the submitted job.

stdout: str | None = None#

Standard output of the submitted job.

step_id: int | None = None#

Step ID of the submitted job.

class qtoolkit.core.data_objects.ProcessPlacement(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: QTKEnum

EVENLY_DISTRIBUTED = 'EVENLY_DISTRIBUTED'#
NO_CONSTRAINTS = 'NO_CONSTRAINTS'#
SAME_NODE = 'SAME_NODE'#
SCATTERED = 'SCATTERED'#
class qtoolkit.core.data_objects.QJob(name: 'str | None' = None, job_id: 'str | None' = None, exit_status: 'int | None' = None, state: 'QState | None' = None, sub_state: 'QSubState | None' = None, info: 'QJobInfo | None' = None, account: 'str | None' = None, runtime: 'int | None' = None, queue_name: 'str | None' = None)[source]#

Bases: QTKObject

account: str | None = None#

Job execution account name.

exit_status: int | None = None#

Shell exit status.

info: QJobInfo | None = None#

Job info.

job_id: str | None = None#

Job ID.

name: str | None = None#

Job name.

queue_name: str | None = None#

Job execution queue name.

runtime: int | None = None#

Job runtime in seconds.

state: QState | None = None#

Standardized job state.

sub_state: QSubState | None = None#

Standardized job substate.

class qtoolkit.core.data_objects.QJobInfo(memory: 'int | None' = None, memory_per_cpu: 'int | None' = None, nodes: 'int | None' = None, cpus: 'int | None' = None, threads_per_process: 'int | None' = None, time_limit: 'int | None' = None)[source]#

Bases: QTKObject

cpus: int | None = None#

Number of CPUs.

memory: int | None = None#

Job memory in Kb.

memory_per_cpu: int | None = None#

Job memory per CPU in Kb.

nodes: int | None = None#

Number of nodes.

threads_per_process: int | None = None#

Number of threads per process.

time_limit: int | None = None#

Time limit in seconds.

class qtoolkit.core.data_objects.QResources(queue_name: str | None = None, job_name: str | None = None, memory_per_thread: int | None = None, nodes: int | None = None, processes: int | None = None, processes_per_node: int | None = None, threads_per_process: int | None = None, gpus_per_job: int | None = None, time_limit: int | None = None, account: str | None = None, qos: str | None = None, priority: int | str | None = None, output_filepath: str | Path | None = None, error_filepath: str | Path | None = None, process_placement: ProcessPlacement | None = None, email_address: str | None = None, rerunnable: bool | None = None, project: str | None = None, njobs: int | None = None, scheduler_kwargs: dict | None = None)[source]#

Bases: QTKObject

Data defining resources for a given job (submitted or to be submitted).

account: str | None = None#

Account to charge the job to.

check_empty() bool[source]#

Check if the QResouces is empty and its content is coherent. Raises an error if process_placement is None, but some attributes are set.

email_address: str | None = None#

Email address to send notifications to.

error_filepath: str | Path | None = None#

Filepath for the standard error.

classmethod evenly_distributed(nodes, processes_per_node, **kwargs)[source]#
get_processes_distribution() list[source]#
gpus_per_job: int | None = None#

Number of GPUs per job.

job_name: str | None = None#

Name of the job.

memory_per_thread: int | None = None#

Memory per thread in MB.

njobs: int | None = None#

Number of jobs in a job array.

classmethod no_constraints(processes, **kwargs)[source]#
nodes: int | None = None#

Number of nodes.

output_filepath: str | Path | None = None#

Filepath for the standard output.

priority: int | str | None = None#

Priority of the job.

process_placement: ProcessPlacement | None = None#

Process placement.

processes: int | None = None#

Number of processes.

processes_per_node: int | None = None#

Number of processes per node.

project: str | None = None#

Project to charge the job to.

qos: str | None = None#

Quality of service.

queue_name: str | None = None#

Name of the queue to submit the job to.

rerunnable: bool | None = None#

Whether the job is rerunnable.

classmethod same_node(processes, **kwargs)[source]#
classmethod scattered(processes, **kwargs)[source]#
scheduler_kwargs: dict | None = None#

Additional keyword arguments to be passed to the scheduler IO.

threads_per_process: int | None = None#

Number of threads per process.

time_limit: int | None = None#

Time limit for the job. In seconds

class qtoolkit.core.data_objects.QState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: QTKEnum

Enumeration of possible (“standardized”) job states.

These “standardized” states are based on the drmaa specification. A mapping between the actual job states in a given queue manager (e.g. PBS, SLURM, …) needs to be defined.

UNDETERMINED: The job status cannot be determined. This is a permanent issue, not being solvable by asking again for the job state. QUEUED: The job is queued for being scheduled and executed. QUEUED HELD: The job has been placed on hold by the system, the administrator, or the submitting user. RUNNING: The job is running on an execution host. SUSPENDED: The job has been suspended by the user, the system or the administrator. REQUEUED: The job was re-queued by the DRM system, and is eligible to run. REQUEUED HELD: The job was re-queued by the DRM system, and is currently placed on hold by the system, the administrator, or the submitting user. DONE: The job finished without an error. FAILED: The job exited abnormally before finishing.

Note that not all these standardized states are available in the actual queue manager implementations.

DONE = 'DONE'#
FAILED = 'FAILED'#
QUEUED = 'QUEUED'#
QUEUED_HELD = 'QUEUED_HELD'#
REQUEUED = 'REQUEUED'#
REQUEUED_HELD = 'REQUEUED_HELD'#
RUNNING = 'RUNNING'#
SUSPENDED = 'SUSPENDED'#
UNDETERMINED = 'UNDETERMINED'#
class qtoolkit.core.data_objects.QSubState(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: QTKEnum

QSubState class defined without any enum values so it can be subclassed.

These sub-states should be the actual job states in a given queuing system (e.g. PBS, SLURM, …). This class is also extended to support multiple values for the same key.

abstract property qstate: QState#
class qtoolkit.core.data_objects.SubmissionResult(job_id: 'int | str | None' = None, step_id: 'int | None' = None, exit_code: 'int | None' = None, stdout: 'str | None' = None, stderr: 'str | None' = None, status: 'SubmissionStatus | None' = None)[source]#

Bases: OperationResult

status: SubmissionStatus | None = None#

Status of the submission.

class qtoolkit.core.data_objects.SubmissionStatus(value, names=None, *, module=None, qualname=None, type=None, start=1, boundary=None)[source]#

Bases: QTKEnum

FAILED = 'FAILED'#
JOB_ID_UNKNOWN = 'JOB_ID_UNKNOWN'#
SUCCESSFUL = 'SUCCESSFUL'#