toil.test.src.jobServiceTest¶
Attributes¶
Classes¶
Tests testing the Job.Service class |
|
Tests testing the Job.Service class |
|
Abstract class used to define the interface to a service. |
|
Abstract class used to define the interface to a service. |
Functions¶
|
Creates one service and one accessing job, which communicate with two files to establish |
|
Creates a chain of services and accessing jobs, each paired together. |
|
Creates multiple chains of services and accessing jobs. |
|
Writes a random integer iinto the inJobStoreFileID file, then tries 10 times reading |
|
Function concatenates the strings together and writes them to the output file |
Module Contents¶
- toil.test.src.jobServiceTest.logger¶
- class toil.test.src.jobServiceTest.TestJobService¶
Tests testing the Job.Service class
- testServiceSerialization(tmp_path)¶
Tests that a service can receive a promise without producing a serialization error.
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- testService(tmp_path, checkpoint=False)¶
Tests the creation of a Job.Service with random failures of the worker.
- Parameters:
tmp_path (pathlib.Path)
checkpoint (bool)
- Return type:
None
- testServiceDeadlock(tmp_path)¶
Creates a job with more services than maxServices, checks that deadlock is detected.
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- testServiceWithCheckpoints(tmp_path)¶
Tests the creation of a Job.Service with random failures of the worker, making the root job use checkpointing to restart the subtree.
- Parameters:
tmp_path (pathlib.Path)
- Return type:
None
- testServiceRecursive(tmp_path, checkpoint=True)¶
Tests the creation of a Job.Service, creating a chain of services and accessing jobs. Randomly fails the worker.
- Parameters:
tmp_path (pathlib.Path)
checkpoint (bool)
- Return type:
None
- testServiceParallelRecursive(tmp_path, checkpoint=True)¶
Tests the creation of a Job.Service, creating parallel chains of services and accessing jobs. Randomly fails the worker.
- Parameters:
tmp_path (pathlib.Path)
checkpoint (bool)
- Return type:
None
- runToil(tmp_path, rootJob, retryCount=1, badWorker=0.5, badWorkedFailInterval=0.1, maxServiceJobs=sys.maxsize, deadlockWait=60, max_attempts=50)¶
- Parameters:
tmp_path (pathlib.Path)
rootJob (toil.job.Job)
retryCount (int)
badWorker (float)
badWorkedFailInterval (float)
maxServiceJobs (int)
deadlockWait (int)
max_attempts (int)
- Return type:
None
- class toil.test.src.jobServiceTest.TestPerfectServicet¶
Bases:
TestJobServiceTests testing the Job.Service class
- runToil(*args, **kwargs)¶
Let us run all the tests in the other service test class, but without worker failures.
- Parameters:
args (Any)
kwargs (Any)
- Return type:
None
- toil.test.src.jobServiceTest.serviceTest(job, outFile, messageInt)¶
Creates one service and one accessing job, which communicate with two files to establish that both run concurrently.
- Parameters:
job (toil.job.Job)
outFile (pathlib.Path)
messageInt (int)
- Return type:
None
- toil.test.src.jobServiceTest.serviceTestRecursive(job, outFile, messages)¶
Creates a chain of services and accessing jobs, each paired together.
- Parameters:
job (toil.job.Job)
outFile (pathlib.Path)
- Return type:
None
- toil.test.src.jobServiceTest.serviceTestParallelRecursive(job, outFiles, messageBundles)¶
Creates multiple chains of services and accessing jobs.
- Parameters:
job (toil.job.Job)
outFiles (list[pathlib.Path])
- Return type:
None
- class toil.test.src.jobServiceTest.ToyService(messageInt, *args, **kwargs)¶
Bases:
toil.job.Job.ServiceAbstract 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.
- Parameters:
messageInt (int)
args (Any)
kwargs (Any)
- messageInt¶
- start(job)¶
Start the service.
- Parameters:
job (toil.job.ServiceHostJob) – 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.
- Returns:
An object describing how to access the service. The object must be pickleable and will be used by jobs to access the service (see
toil.job.Job.addService()).- Return type:
- stop(job)¶
Stops the service. Function can block until complete.
- Parameters:
job (toil.job.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:
None
- check()¶
Checks the service is still running.
- Raises:
exceptions.RuntimeError – If the service failed, this will cause the service job to be labeled failed.
- Returns:
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!
- Return type:
Literal[True]
- static serviceWorker(jobStore, terminate, error, inJobStoreID, outJobStoreID, messageInt)¶
- Parameters:
terminate (threading.Event)
error (threading.Event)
inJobStoreID (str)
outJobStoreID (str)
messageInt (int)
- Return type:
None
- toil.test.src.jobServiceTest.serviceAccessor(job, communicationFiles, outFile, to_subtract)¶
Writes a random integer iinto the inJobStoreFileID file, then tries 10 times reading from outJobStoreFileID to get a pair of integers, the first equal to i the second written into the outputFile.
- Parameters:
job (toil.job.ServiceHostJob)
outFile (pathlib.Path)
to_subtract (int)
- Return type:
None
- class toil.test.src.jobServiceTest.ToySerializableService(messageInt, *args, **kwargs)¶
Bases:
toil.job.Job.ServiceAbstract 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.
- Parameters:
messageInt (str)
args (Any)
kwargs (Any)
- messageInt¶
- start(job)¶
Start the service.
- Parameters:
job (toil.job.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.
- Returns:
An object describing how to access the service. The object must be pickleable and will be used by jobs to access the service (see
toil.job.Job.addService()).- Return type:
- stop(job)¶
Stops the service. Function can block until complete.
- Parameters:
job (toil.job.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:
None
- check()¶
Checks the service is still running.
- Raises:
exceptions.RuntimeError – If the service failed, this will cause the service job to be labeled failed.
- Returns:
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!
- Return type:
Literal[True]
- toil.test.src.jobServiceTest.fnTest(strings, outputFile)¶
Function concatenates the strings together and writes them to the output file
- Parameters:
outputFile (pathlib.Path)
- Return type:
None