toil.test.src.checkpointTest

Module Contents

Classes

CheckpointTest

A common base class for Toil tests.

CheckRetryCount

Fail N times, succeed on the next try.

AlwaysFail

Class represents a unit of work in toil.

CheckpointFailsFirstTime

Class represents a unit of work in toil.

FailOnce

Fail the first time the workflow is run, but succeed thereafter.

class toil.test.src.checkpointTest.CheckpointTest(methodName='runTest')[source]

Bases: toil.test.ToilTest

A 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.

testCheckpointNotRetried()[source]

A checkpoint job should not be retried if the workflow has a retryCount of 0.

testCheckpointRetriedOnce()[source]

A checkpoint job should be retried exactly once if the workflow has a retryCount of 1.

testCheckpointedRestartSucceeds()[source]

A checkpointed job should succeed on restart of a failed run if its child job succeeds.

class toil.test.src.checkpointTest.CheckRetryCount(numFailuresBeforeSuccess)[source]

Bases: toil.job.Job

Fail N times, succeed on the next try.

getNumRetries(fileStore)[source]

Mark a retry in the fileStore, and return the number of retries so far.

run(fileStore)[source]

Override this function to perform work and dynamically create successor jobs.

Parameters:

fileStore – Used to create local and globally sharable temporary files and to send log messages to the leader process.

Returns:

The return value of the function can be passed to other jobs by means of toil.job.Job.rv().

class toil.test.src.checkpointTest.AlwaysFail(memory=None, cores=None, disk=None, accelerators=None, preemptible=None, preemptable=None, unitName='', checkpoint=False, displayName='', descriptionClass=None, local=None)[source]

Bases: toil.job.Job

Class represents a unit of work in toil.

Parameters:
  • memory (Optional[ParseableIndivisibleResource]) –

  • cores (Optional[ParseableDivisibleResource]) –

  • disk (Optional[ParseableIndivisibleResource]) –

  • accelerators (Optional[ParseableAcceleratorRequirement]) –

  • preemptible (Optional[ParseableFlag]) –

  • preemptable (Optional[ParseableFlag]) –

  • unitName (Optional[str]) –

  • checkpoint (Optional[bool]) –

  • displayName (Optional[str]) –

  • descriptionClass (Optional[type]) –

  • local (Optional[bool]) –

run(fileStore)[source]

Override this function to perform work and dynamically create successor jobs.

Parameters:

fileStore – Used to create local and globally sharable temporary files and to send log messages to the leader process.

Returns:

The return value of the function can be passed to other jobs by means of toil.job.Job.rv().

class toil.test.src.checkpointTest.CheckpointFailsFirstTime[source]

Bases: toil.job.Job

Class represents a unit of work in toil.

run(fileStore)[source]

Override this function to perform work and dynamically create successor jobs.

Parameters:

fileStore – Used to create local and globally sharable temporary files and to send log messages to the leader process.

Returns:

The return value of the function can be passed to other jobs by means of toil.job.Job.rv().

class toil.test.src.checkpointTest.FailOnce(memory=None, cores=None, disk=None, accelerators=None, preemptible=None, preemptable=None, unitName='', checkpoint=False, displayName='', descriptionClass=None, local=None)[source]

Bases: toil.job.Job

Fail the first time the workflow is run, but succeed thereafter.

Parameters:
  • memory (Optional[ParseableIndivisibleResource]) –

  • cores (Optional[ParseableDivisibleResource]) –

  • disk (Optional[ParseableIndivisibleResource]) –

  • accelerators (Optional[ParseableAcceleratorRequirement]) –

  • preemptible (Optional[ParseableFlag]) –

  • preemptable (Optional[ParseableFlag]) –

  • unitName (Optional[str]) –

  • checkpoint (Optional[bool]) –

  • displayName (Optional[str]) –

  • descriptionClass (Optional[type]) –

  • local (Optional[bool]) –

run(fileStore)[source]

Override this function to perform work and dynamically create successor jobs.

Parameters:

fileStore – Used to create local and globally sharable temporary files and to send log messages to the leader process.

Returns:

The return value of the function can be passed to other jobs by means of toil.job.Job.rv().