toil.test.batchSystems.test_slurm

Attributes

logger

Classes

FakeBatchSystem

Class that implements a minimal Batch System, needed to create a Worker (see below).

SlurmTest

Class for unit-testing SlurmBatchSystem

Functions

call_sacct(args, **_)

The arguments passed to call_command when executing sacct are:

call_scontrol(args, **_)

The arguments passed to call_command when executing scontrol are:

call_sacct_raises(*_)

Fake that the sacct command fails by raising a CalledProcessErrorStderr

call_sinfo(*_)

Simulate asking for partition info from Slurm

Module Contents

toil.test.batchSystems.test_slurm.logger
toil.test.batchSystems.test_slurm.call_sacct(args, **_)

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:

str

toil.test.batchSystems.test_slurm.call_scontrol(args, **_)

The arguments passed to call_command when executing scontrol are: ['scontrol', 'show', 'job'] or ['scontrol', 'show', 'job', '<job-id>']

Return type:

str

toil.test.batchSystems.test_slurm.call_sacct_raises(*_)

Fake that the sacct command fails by raising a CalledProcessErrorStderr

toil.test.batchSystems.test_slurm.call_sinfo(*_)

Simulate asking for partition info from Slurm

Return type:

str

class toil.test.batchSystems.test_slurm.FakeBatchSystem

Bases: toil.batchSystems.abstractBatchSystem.BatchSystemSupport

Class that implements a minimal Batch System, needed to create a Worker (see below).

getWaitDuration()
class toil.test.batchSystems.test_slurm.SlurmTest(methodName='runTest')

Bases: toil.test.ToilTest

Class for unit-testing SlurmBatchSystem

setUp()

Hook method for setting up the test fixture before exercising it.

test_getJobDetailsFromSacct_one_exists()
test_getJobDetailsFromSacct_one_not_exists()
test_getJobDetailsFromSacct_many_all_exist()
test_getJobDetailsFromSacct_many_some_exist()
test_getJobDetailsFromSacct_many_none_exist()
test_getJobDetailsFromSacct_argument_list_too_big()
test_getJobDetailsFromScontrol_one_exists()
test_getJobDetailsFromScontrol_one_not_exists()

Asking for the job details of a single job that scontrol doesn’t know about should raise an exception.

test_getJobDetailsFromScontrol_many_all_exist()
test_getJobDetailsFromScontrol_many_some_exist()
test_getJobDetailsFromScontrol_many_none_exist()
test_getJobExitCode_job_exists()
test_getJobExitCode_job_not_exists()
test_getJobExitCode_sacct_raises_job_exists()

This test forces the use of scontrol to get job information, by letting sacct raise an exception.

test_getJobExitCode_sacct_raises_job_not_exists()

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.

test_coalesce_job_exit_codes_one_exists()
test_coalesce_job_exit_codes_one_not_exists()
test_coalesce_job_exit_codes_many_all_exist()
test_coalesce_job_exit_codes_some_exists()
test_coalesce_job_exit_codes_sacct_raises_job_exists()

This test forces the use of scontrol to get job information, by letting sacct raise an exception.

test_coalesce_job_exit_codes_sacct_raises_job_not_exists()

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.

test_PartitionSet_get_partition()
test_PartitionSet_default_gpu_partition()
test_prepareSbatch_partition()
test_prepareSbatch_time()
test_prepareSbatch_export()
test_option_detector()
test_any_option_detector()