toil.test.batchSystems.test_slurm¶
Attributes¶
Exceptions¶
Version of CalledProcessError that include stderr in the error message if it is set |
Classes¶
Enum where members are also (and must be) ints |
|
Class to represent configuration operations for a toil workflow run. |
|
A common base class for Toil tests. |
|
Class that implements a minimal Batch System, needed to create a Worker (see below). |
|
Class for unit-testing SlurmBatchSystem |
Functions¶
|
The arguments passed to call_command when executing sacct are: |
|
The arguments passed to call_command when executing scontrol are: |
Fake that the sacct command fails by raising a CalledProcessErrorStderr |
Module Contents¶
- class toil.test.batchSystems.test_slurm.BatchJobExitReason[source]¶
Bases:
enum.IntEnumEnum where members are also (and must be) ints
- toil.test.batchSystems.test_slurm.EXIT_STATUS_UNAVAILABLE_VALUE = 255¶
- class toil.test.batchSystems.test_slurm.Config[source]¶
Class to represent configuration operations for a toil workflow run.
- batch_logs_dir: str | None¶
The backing scheduler will be instructed, if possible, to save logs to this directory, where the leader can read them.
- workflowID: str | None¶
This attribute uniquely identifies the job store and therefore the workflow. It is necessary in order to distinguish between two consecutive workflows for which self.jobStore is the same, e.g. when a job store name is reused after a previous run has finished successfully and its job store has been clean up.
- defaultAccelerators: List[toil.job.AcceleratorRequirement]¶
- prepare_start()[source]¶
After options are set, prepare for initial start of workflow.
- Return type:
None
- prepare_restart()[source]¶
Before restart options are set, prepare for a restart of a workflow. Set up any execution-specific parameters and clear out any stale ones.
- Return type:
None
- setOptions(options)[source]¶
Creates a config object from the options object.
- Parameters:
options (argparse.Namespace)
- Return type:
None
- exception toil.test.batchSystems.test_slurm.CalledProcessErrorStderr(returncode, cmd, output=None, stderr=None)[source]¶
Bases:
subprocess.CalledProcessErrorVersion of CalledProcessError that include stderr in the error message if it is set
- class toil.test.batchSystems.test_slurm.ToilTest(methodName='runTest')[source]¶
Bases:
unittest.TestCaseA common base class for Toil tests.
Please have every test case directly or indirectly inherit this one.
When running tests you may optionally set the TOIL_TEST_TEMP environment variable to the path of a directory where you want temporary test files be placed. The directory will be created if it doesn’t exist. The path may be relative in which case it will be assumed to be relative to the project root. If TOIL_TEST_TEMP is not defined, temporary files and directories will be created in the system’s default location for such files and any temporary files or directories left over from tests will be removed automatically removed during tear down. Otherwise, left-over files will not be removed.
- classmethod setUpClass()[source]¶
Hook method for setting up class fixture before running tests in the class.
- Return type:
None
- classmethod tearDownClass()[source]¶
Hook method for deconstructing the class fixture after running all tests in the class.
- Return type:
None
- setUp()[source]¶
Hook method for setting up the test fixture before exercising it.
- Return type:
None
- toil.test.batchSystems.test_slurm.call_sacct(args, **_)[source]¶
The arguments passed to call_command when executing sacct are: [‘sacct’, ‘-n’, ‘-j’, ‘<comma-separated list of job-ids>’, ‘–format’, ‘JobIDRaw,State,ExitCode’, ‘-P’, ‘-S’, ‘1970-01-01’] The multi-line output is something like:
1234|COMPLETED|0:0 1234.batch|COMPLETED|0:0 1235|PENDING|0:0 1236|FAILED|0:2 1236.extern|COMPLETED|0:0
- Return type:
- toil.test.batchSystems.test_slurm.call_scontrol(args, **_)[source]¶
The arguments passed to call_command when executing scontrol are:
['scontrol', 'show', 'job']or['scontrol', 'show', 'job', '<job-id>']- Return type:
- toil.test.batchSystems.test_slurm.call_sacct_raises(*_)[source]¶
Fake that the sacct command fails by raising a CalledProcessErrorStderr
- class toil.test.batchSystems.test_slurm.FakeBatchSystem[source]¶
Class that implements a minimal Batch System, needed to create a Worker (see below).
- class toil.test.batchSystems.test_slurm.SlurmTest(methodName='runTest')[source]¶
Bases:
toil.test.ToilTestClass for unit-testing SlurmBatchSystem
- test_getJobDetailsFromScontrol_one_not_exists()[source]¶
Asking for the job details of a single job that scontrol doesn’t know about should raise an exception.
- test_getJobExitCode_sacct_raises_job_exists()[source]¶
This test forces the use of scontrol to get job information, by letting sacct raise an exception.
- test_getJobExitCode_sacct_raises_job_not_exists()[source]¶
This test forces the use of scontrol to get job information, by letting sacct raise an exception. Next, scontrol should also raise because it doesn’t know the job.