Toil Class API

The Toil class configures and starts a Toil run.

class toil.common.Toil(options: argparse.Namespace)[source]

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

__init__(options: argparse.Namespace) → None[source]

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 – command line options specified by the user
config = None
Type:toil.common.Config
start(rootJob)[source]

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
restart()[source]

Restarts a workflow that has been interrupted.

Returns:The root job’s return value
classmethod getJobStore(locator: str) → AbstractJobStore[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
static createBatchSystem(config: toil.common.Config) → AbstractBatchSystem[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
import_file(src_uri: str, shared_file_name: Optional[str] = None, symlink: bool = False) → Union[toil.fileStores.FileID, str, None][source]

Imports the file at the given URL into job store.

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

export_file(file_id: Union[toil.fileStores.FileID, str], dst_uri: str) → None[source]

Exports file to destination pointed at by the destination URL.

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

static normalize_uri(uri: str, check_existence: bool = False) → str[source]

Given a URI, if it has no scheme, prepend “file:”.

Parameters:check_existence – If set, raise an error if a URI points to a local file that does not exist.
static getToilWorkDir(configWorkDir: Optional[str] = None) → str[source]

Returns a path to a writable directory under which per-workflow directories exist. This directory is always required to exist on a machine, even if the Toil worker has not run yet. If your workers and leader have different temp directories, you may need to set TOIL_WORKDIR.

Parameters:configWorkDir (str) – Value passed to the program using the –workDir flag
Returns:Path to the Toil work directory, constant across all machines
Return type:str
classmethod getLocalWorkflowDir(workflowID: str, configWorkDir: Optional[str] = None) → str[source]

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

Parameters:configWorkDir – Value passed to the program using the –workDir flag
Returns:Path to the local workflow directory on this machine
writePIDFile()[source]

Write a the pid of this process to a file in the jobstore.

Overwriting the current contents of pid.log is a feature, not a bug of this method. Other methods will rely on always having the most current pid available. So far there is no reason to store any old pids.