Toil Class API

The Toil class configures and starts a Toil run.

class toil.common.Toil(options)[source]

A context manager that represents a Toil workflow, specifically the batch system, job store, and its configuration.


Initialize a Toil object from the given options. Note that this is very light-weight and that the bulk of the work is done when the context is entered.

Parameters:options (argparse.Namespace) – command line options specified by the user
config = None

Invoke a Toil workflow with the given job as the root for an initial run. This method must be called in the body of a with Toil(...) as toil: statement. This method should not be called more than once for a workflow that has not finished.

Parameters:rootJob (toil.job.Job) – The root job of the workflow
Returns:The root job’s return value

Restarts a workflow that has been interrupted.

Returns:The root job’s return value
classmethod getJobStore(locator)[source]

Create an instance of the concrete job store implementation that matches the given locator.

Parameters:locator (str) – The location of the job store to be represent by the instance
Returns:an instance of a concrete subclass of AbstractJobStore
Return type:toil.jobStores.abstractJobStore.AbstractJobStore
static createBatchSystem(config)[source]

Creates an instance of the batch system specified in the given config.

Parameters:config (toil.common.Config) – the current configuration
Return type:batchSystems.abstractBatchSystem.AbstractBatchSystem
Returns:an instance of a concrete subclass of AbstractBatchSystem
importFile(srcUrl, sharedFileName=None)[source]

Imports the file at the given URL into job store.

See toil.jobStores.abstractJobStore.AbstractJobStore.importFile() for a full description

exportFile(jobStoreFileID, dstUrl)[source]

Exports file to destination pointed at by the destination URL.

See toil.jobStores.abstractJobStore.AbstractJobStore.exportFile() for a full description

static getWorkflowDir(workflowID, configWorkDir=None)[source]

Returns a path to the directory where worker directories and the cache will be located for this workflow.

  • workflowID (str) – Unique identifier for the workflow
  • configWorkDir (str) – Value passed to the program using the –workDir flag

Path to the workflow directory

Return type: