The Service class allows databases and servers to be spawned within a Toil workflow.
- class Job.Service(memory=None, cores=None, disk=None, accelerators=None, preemptible=None, unitName=None)[source]
Abstract class used to define the interface to a service.
Should be subclassed by the user to define services.
Is not executed as a job; runs within a ServiceHostJob.
- __init__(memory=None, cores=None, disk=None, accelerators=None, preemptible=None, unitName=None)[source]
Memory, core and disk requirements are specified identically to as in
- abstract start(job)[source]
Start the service.
Job) – The underlying host job that the service is being run in. Can be used to register deferred functions, or to access the fileStore for creating temporary files.
- Return type
An object describing how to access the service. The object must be pickleable and will be used by jobs to access the service (see
- abstract stop(job)[source]
Stops the service. Function can block until complete.
Checks the service is still running.
exceptions.RuntimeError – If the service failed, this will cause the service job to be labeled failed.
- Return type
True if the service is still running, else False. If False then the service job will be terminated, and considered a success. Important point: if the service job exits due to a failure, it should raise a RuntimeError, not return False!