Pipeline management software for clusters.
npx @tessl/cli install tessl/pypi-toil@9.0.0Toil is a comprehensive Python pipeline management and workflow execution system designed for distributed computing environments. It provides robust job scheduling, cloud provisioning, and container execution capabilities across various batch systems including Slurm, LSF, Kubernetes, and local execution. Toil supports multiple workflow languages including CWL (Common Workflow Language) and WDL (Workflow Description Language), making it a versatile solution for scientific computing and data processing pipelines.
toiltoil.version module)toilpip install toil# Essential workflow components
from toil.common import Toil, Config
from toil.job import Job, JobDescription, Promise, AcceleratorRequirement
from toil.fileStores import AbstractFileStore, FileID
# Exception handling
from toil.exceptions import FailedJobsException
# Utility functions
from toil.lib.conversions import human2bytes, bytes2human
from toil.lib.retry import retry
from toil import physicalMemory, physicalDisk, toilPackageDirPathfrom toil.common import Toil, Config
from toil.job import Job
class HelloWorldJob(Job):
def __init__(self, message):
# 100MB memory, 1 core, 100MB disk
super().__init__(memory=100*1024*1024, cores=1, disk=100*1024*1024)
self.message = message
def run(self, fileStore):
fileStore.logToMaster(f"Hello {self.message}")
return f"Processed: {self.message}"
# Create and run workflow
if __name__ == "__main__":
config = Config()
config.jobStore = "file:my-job-store"
config.logLevel = "INFO"
with Toil(config) as toil:
root_job = HelloWorldJob("World")
result = toil.start(root_job)
print(f"Result: {result}")from toil.common import Toil, Config
from toil.job import Job
@Job.wrapJobFn
def process_data(job, input_data):
# Job automatically gets memory=2G, cores=1, disk=2G by default
job.fileStore.logToMaster(f"Processing: {input_data}")
return input_data.upper()
@Job.wrapJobFn
def combine_results(job, *results):
combined = " + ".join(results)
job.fileStore.logToMaster(f"Combined: {combined}")
return combined
if __name__ == "__main__":
config = Config()
config.jobStore = "file:my-job-store"
with Toil(config) as toil:
# Create processing jobs
job1 = process_data("hello")
job2 = process_data("world")
# Chain jobs together
final_job = combine_results(job1.rv(), job2.rv())
job1.addFollowOn(final_job)
job2.addFollowOn(final_job)
result = toil.start(job1)
print(f"Final result: {result}")Toil's architecture consists of several key components that work together to provide scalable workflow execution:
Job, JobDescription, and Promise classes handle job definition, scheduling, and result handlingConfig classJob classes or function decoratorsToil context manager to execute the workflowPromise objects and return values{ .api }
Basic job creation, execution, and chaining capabilities with resource management and promise-based result handling.
Key APIs:
Job(memory, cores, disk, accelerators, preemptible, checkpoint) - Job definition with resource requirementsJob.addChild(childJob) - Add dependent child jobsJob.addFollowOn(followOnJob) - Add sequential follow-on jobsJob.rv(*path) - Create promise for job return valueToil(config).start(rootJob) - Execute workflow with root jobConfig() - Workflow configuration and batch system settings{ .api }
Support for multiple compute environments including local execution, HPC schedulers, and cloud services.
Key APIs:
AbstractBatchSystem.issueBatchJob(jobNode) - Submit job to batch systemAbstractBatchSystem.getUpdatedBatchJob(maxWait) - Monitor job statusAbstractScalableBatchSystem.nodeTypes() - Query available node typesKubernetesBatchSystem, SlurmBatchSystem, LSFBatchSystem - Concrete implementationsBatchJobExitReason - Job completion status enumeration{ .api }
Persistent storage backends for workflow metadata and state management across different storage systems.
Key APIs:
AbstractJobStore.create(jobDescription) - Store job metadataAbstractJobStore.load(jobStoreID) - Retrieve job by IDAbstractJobStore.writeFile(localFilePath) - Store file in job storeAbstractJobStore.importFile(srcUrl, sharedFileName) - Import external filesFileJobStore, AWSJobStore, GoogleJobStore - Storage backend implementations{ .api }
Comprehensive file handling for temporary files, shared data, and persistent storage during workflow execution.
Key APIs:
AbstractFileStore.writeGlobalFile(localFileName) - Store globally accessible filesAbstractFileStore.readGlobalFile(fileStoreID, userPath, cache) - Read shared filesAbstractFileStore.getLocalTempDir() - Get temporary directoryAbstractFileStore.logToMaster(text, level) - Send logs to workflow leaderFileID - File identifier type for referencing stored files{ .api }
Native support for CWL and WDL workflow specifications with seamless translation to Toil execution.
Key APIs:
toil-cwl-runner - Command-line CWL workflow executiontoil-wdl-runner - Command-line WDL workflow executiontoil.cwl.cwltoil.main() - Programmatic CWL executiontoil.wdl.wdltoil.main() - Programmatic WDL execution{ .api }
Automatic cloud resource provisioning and cluster management for scalable workflow execution.
Key APIs:
AbstractProvisioner - Base provisioner interfacetoil-launch-cluster - Cluster creation utilitytoil-destroy-cluster - Cluster cleanup utility{ .api }
Comprehensive command-line tools and utilities for workflow management, debugging, and monitoring.
Key APIs:
toil - Main CLI interface for workflow executiontoil-stats - Statistics collection and analysistoil-status - Workflow monitoring and statustoil-clean - Cleanup utilities and job store managementtoil-kill - Workflow termination utilities