toil.serviceManager

Attributes

logger

Classes

ServiceManager

Manages the scheduling of services.

Module Contents

toil.serviceManager.logger
class toil.serviceManager.ServiceManager(job_store, toil_state)[source]

Manages the scheduling of services.

Parameters:
services_are_starting(job_id)[source]

Check if services are being started.

Returns:

True if the services for the given job are currently being started, and False otherwise.

Parameters:

job_id (str)

Return type:

bool

get_job_count()[source]

Get the total number of jobs we are working on.

(services and their parent non-service jobs)

Return type:

int

start()[source]

Start the service scheduling thread.

Return type:

None

put_client(client_id)[source]

Schedule the services of a job asynchronously.

When the job’s services are running the ID for the job will be returned by toil.leader.ServiceManager.get_ready_client.

Parameters:

client_id (str) – ID of job with services to schedule.

Return type:

None

get_ready_client(maxWait)[source]

Fetch a ready client, waiting as needed.

Parameters:

maxWait (float) – Time in seconds to wait to get a JobDescription before returning

Returns:

the ID of a client whose services are running, or None if no such job is available.

Return type:

Optional[str]

get_unservable_client(maxWait)[source]

Fetch a client whos services failed to start.

Parameters:

maxWait (float) – Time in seconds to wait to get a JobDescription before returning

Returns:

the ID of a client whose services failed to start, or None if no such job is available.

Return type:

Optional[str]

get_startable_service(maxWait)[source]

Fetch a service job that is ready to start.

Parameters:

maxWait (float) – Time in seconds to wait to get a job before returning.

Returns:

the ID of a service job that the leader can start, or None if no such job exists.

Return type:

Optional[str]

kill_services(service_ids, error=False)[source]

Stop all the given service jobs.

Parameters:
  • services – Service jobStoreIDs to kill

  • error (bool) – Whether to signal that the service failed with an error when stopping it.

  • service_ids (Iterable[str])

Return type:

None

is_active(service_id)[source]

Return true if the service job has not been told to terminate.

Parameters:

service_id (str) – Service to check on

Return type:

bool

is_running(service_id)[source]

Return true if the service job has started and is active.

Parameters:
  • service – Service to check on

  • service_id (str)

Return type:

bool

check()[source]

Check on the service manager thread.

Raises:

RuntimeError – If the underlying thread has quit.

Return type:

None

shutdown()[source]

Terminate worker threads cleanly; starting and killing all service threads.

Will block until all services are started and blocked.

Return type:

None