toil.test.wdl.wdltoil_test¶
Attributes¶
Classes¶
A common base class for Toil tests. |
|
Job that can create more graph for a section of the wrokflow. |
|
Represents a graph of WDL WorkflowNodes. |
|
Base test class for WDL tests. |
|
WDL conformance tests for Toil. |
|
Tests for Toil's MiniWDL-based implementation. |
Functions¶
|
Find and instantiate the appropriate provisioner instance to make clusters in the given cloud. |
|
Use as a decorator before test classes or methods to only run them if |
|
Use as a decorator before test classes or methods to run only if Google |
|
Use as a decorator before test classes or methods to only run them if |
|
Use as a decorator before test classes or methods to only run them if miniwdl is installed |
|
Use this decorator to identify tests that are slow and not critical. |
|
Use this to decorate integration tests so as to skip them during regular builds. |
Module Contents¶
- toil.test.wdl.wdltoil_test.cluster_factory(provisioner, clusterName=None, clusterType='mesos', zone=None, nodeStorage=50, nodeStorageOverrides=None, sseKey=None, enable_fuse=False)¶
Find and instantiate the appropriate provisioner instance to make clusters in the given cloud.
Raises ClusterTypeNotSupportedException if the given provisioner does not implement clusters of the given type.
- Parameters:
provisioner (str) – The cloud type of the cluster.
clusterName (Optional[str]) – The name of the cluster.
clusterType (str) – The type of cluster: ‘mesos’ or ‘kubernetes’.
zone (Optional[str]) – The cloud zone
nodeStorage (int)
nodeStorageOverrides (Optional[List[str]])
sseKey (Optional[str])
enable_fuse (bool)
- Returns:
A cluster object for the the cloud type.
- Return type:
Union[aws.awsProvisioner.AWSProvisioner, gceProvisioner.GCEProvisioner]
- class toil.test.wdl.wdltoil_test.ToilTest(methodName='runTest')¶
Bases:
unittest.TestCaseA common base class for Toil tests.
Please have every test case directly or indirectly inherit this one.
When running tests you may optionally set the TOIL_TEST_TEMP environment variable to the path of a directory where you want temporary test files be placed. The directory will be created if it doesn’t exist. The path may be relative in which case it will be assumed to be relative to the project root. If TOIL_TEST_TEMP is not defined, temporary files and directories will be created in the system’s default location for such files and any temporary files or directories left over from tests will be removed automatically removed during tear down. Otherwise, left-over files will not be removed.
- setup_method(method)¶
- Parameters:
method (Any)
- Return type:
None
- classmethod setUpClass()¶
Hook method for setting up class fixture before running tests in the class.
- Return type:
None
- classmethod tearDownClass()¶
Hook method for deconstructing the class fixture after running all tests in the class.
- Return type:
None
- setUp()¶
Hook method for setting up the test fixture before exercising it.
- Return type:
None
- tearDown()¶
Hook method for deconstructing the test fixture after testing it.
- Return type:
None
- toil.test.wdl.wdltoil_test.needs_docker_cuda(test_item)¶
Use as a decorator before test classes or methods to only run them if a CUDA setup is available through Docker.
- Parameters:
test_item (MT)
- Return type:
MT
- toil.test.wdl.wdltoil_test.needs_google_storage(test_item)¶
Use as a decorator before test classes or methods to run only if Google Cloud is installed and we ought to be able to access public Google Storage URIs.
- Parameters:
test_item (MT)
- Return type:
MT
- toil.test.wdl.wdltoil_test.needs_singularity_or_docker(test_item)¶
Use as a decorator before test classes or methods to only run them if docker is installed and docker-based tests are enabled, or if Singularity is installed.
- Parameters:
test_item (MT)
- Return type:
MT
- toil.test.wdl.wdltoil_test.needs_wdl(test_item)¶
Use as a decorator before test classes or methods to only run them if miniwdl is installed and configured.
- Parameters:
test_item (MT)
- Return type:
MT
- toil.test.wdl.wdltoil_test.slow(test_item)¶
Use this decorator to identify tests that are slow and not critical. Skip if TOIL_TEST_QUICK is true.
- Parameters:
test_item (MT)
- Return type:
MT
- toil.test.wdl.wdltoil_test.integrative(test_item)¶
Use this to decorate integration tests so as to skip them during regular builds.
We define integration tests as A) involving other, non-Toil software components that we develop and/or B) having a higher cost (time or money).
- Parameters:
test_item (MT)
- Return type:
MT
- toil.test.wdl.wdltoil_test.exactPython = 'python3.9'¶
- class toil.test.wdl.wdltoil_test.WDLSectionJob(namespace, task_path, wdl_options=None, **kwargs)¶
Bases:
WDLBaseJobJob that can create more graph for a section of the wrokflow.
- static coalesce_nodes(order, section_graph)¶
Given a topological order of WDL workflow node IDs, produce a list of lists of IDs, still in topological order, where each list of IDs can be run under a single Toil job.
- Parameters:
order (List[str])
section_graph (WDLWorkflowGraph)
- Return type:
List[List[str]]
- create_subgraph(nodes, gather_nodes, environment, local_environment=None, subscript=None)¶
Make a Toil job to evaluate a subgraph inside a workflow or workflow section.
- Returns:
a child Job that will return the aggregated environment after running all the things in the section.
- Parameters:
gather_nodes (Sequence[WDL.Tree.Gather]) – Names exposed by these will always be defined with something, even if the code that defines them does not actually run.
environment (WDLBindings) – Bindings in this environment will be used to evaluate the subgraph and will be passed through.
local_environment (Optional[WDLBindings]) – Bindings in this environment will be used to evaluate the subgraph but will go out of scope at the end of the section.
subscript (Optional[int]) – If the subgraph is being evaluated multiple times, this should be a disambiguating integer for logging.
nodes (Sequence[WDL.Tree.WorkflowNode])
- Return type:
- make_gather_bindings(gathers, undefined)¶
Given a collection of Gathers, create bindings from every identifier gathered, to the given “undefined” placeholder (which would be Null for a single execution of the body, or an empty array for a completely unexecuted scatter).
These bindings can be overlaid with bindings from the actual execution, so that references to names defined in unexecuted code get a proper default undefined value, and not a KeyError at runtime.
The information to do this comes from MiniWDL’s “gathers” system: <https://miniwdl.readthedocs.io/en/latest/WDL.html#WDL.Tree.WorkflowSection.gathers>
TODO: This approach will scale O(n^2) when run on n nested conditionals, because generating these bindings for the outer conditional will visit all the bindings from the inner ones.
- Parameters:
gathers (Sequence[WDL.Tree.Gather])
undefined (WDL.Value.Base)
- Return type:
WDLBindings
- class toil.test.wdl.wdltoil_test.WDLWorkflowGraph(nodes)¶
Represents a graph of WDL WorkflowNodes.
Operates at a certain level of instantiation (i.e. sub-sections are represented by single nodes).
Assumes all relevant nodes are provided; dependencies outside the provided nodes are assumed to be satisfied already.
- Parameters:
nodes (Sequence[WDL.Tree.WorkflowNode])
- real_id(node_id)¶
Map multiple IDs for what we consider the same node to one ID.
This elides/resolves gathers.
- is_decl(node_id)¶
Return True if a node represents a WDL declaration, and false otherwise.
- get_dependencies(node_id)¶
Get all the nodes that a node depends on, recursively (into the node if it has a body) but not transitively.
Produces dependencies after resolving gathers and internal-to-section dependencies, on nodes that are also in this graph.
- get_transitive_dependencies(node_id)¶
Get all the nodes that a node depends on, transitively.
- class toil.test.wdl.wdltoil_test.BaseWDLTest(methodName='runTest')¶
Bases:
toil.test.ToilTestBase test class for WDL tests.
- setUp()¶
Runs anew before each test to create farm fresh temp dirs.
- Return type:
None
- tearDown()¶
Hook method for deconstructing the test fixture after testing it.
- Return type:
None
- class toil.test.wdl.wdltoil_test.WDLConformanceTests(methodName='runTest')¶
Bases:
BaseWDLTestWDL conformance tests for Toil.
- wdl_dir = 'wdl-conformance-tests'¶
- classmethod setUpClass()¶
Hook method for setting up class fixture before running tests in the class.
- Return type:
None
- test_conformance_tests_v10()¶
- test_conformance_tests_v11()¶
- test_conformance_tests_integration()¶
- classmethod tearDownClass()¶
Hook method for deconstructing the class fixture after running all tests in the class.
- Return type:
None
- class toil.test.wdl.wdltoil_test.WDLTests(methodName='runTest')¶
Bases:
BaseWDLTestTests for Toil’s MiniWDL-based implementation.
- classmethod setUpClass()¶
Runs once for all tests.
- Return type:
None
- test_MD5sum()¶
Test if Toil produces the same outputs as known good outputs for WDL’s GATK tutorial #1.
- test_missing_output_directory()¶
Test if Toil can run a WDL workflow into a new directory.
- test_miniwdl_self_test(extra_args=None)¶
Test if the MiniWDL self test runs and produces the expected output.
- Parameters:
extra_args (Optional[List[str]])
- Return type:
None
- test_miniwdl_self_test_by_reference()¶
Test if the MiniWDL self test works when passing input files by URL reference.
- Return type:
None
- test_giraffe_deepvariant()¶
Test if Giraffe and GPU DeepVariant run. This could take 25 minutes.
- test_giraffe()¶
Test if Giraffe runs. This could take 12 minutes. Also we scale it down but it still demands lots of memory.
- test_gs_uri()¶
Test if Toil can access Google Storage URIs.
- test_coalesce()¶
Test if WDLSectionJob can coalesce WDL decls.
White box test; will need to be changed or removed if the WDL interpreter changes.