toil.server.cli.wes_cwl_runner¶
Attributes¶
Classes¶
A modified version of the WESClient from the wes-service package that |
Functions¶
Take in a list of path names and return a list of names with the common path |
|
|
Return a list of dependencies of the given workflow from cwltool. |
|
Given a CWL file, its input files, and an optional list of engine options, |
|
Return True if the given workflow run is in a finished state. |
|
Fetch the workflow logs from the WES server, print the results, then exit |
|
Module Contents¶
- toil.server.cli.wes_cwl_runner.logger¶
- toil.server.cli.wes_cwl_runner.generate_attachment_path_names(paths)¶
Take in a list of path names and return a list of names with the common path name stripped out, while preserving the input order. This guarantees that there are no relative paths that traverse up.
For example, for the following CWL workflow where “hello.yaml” references a file “message.txt”,
~/toil/workflows/hello.cwl ~/toil/input_files/hello.yaml ~/toil/input_files/message.txt
- This may be run with the command:
toil-wes-cwl-runner hello.cwl ../input_files/hello.yaml
Where “message.txt” is resolved to “../input_files/message.txt”.
We’d send the workflow file as “workflows/hello.cwl”, and send the inputs as “input_files/hello.yaml” and “input_files/message.txt”.
- class toil.server.cli.wes_cwl_runner.WESClientWithWorkflowEngineParameters(endpoint, auth=None)¶
Bases:
wes_client.util.WESClient
A modified version of the WESClient from the wes-service package that includes workflow_engine_parameters support.
TODO: Propose a PR in wes-service to include workflow_engine_params.
- get_version(extension, workflow_file)¶
Determines the version of a .py, .wdl, or .cwl file.
- parse_params(workflow_params_file)¶
Parse the CWL input file into a dictionary to be attached to the body of the WES run request.
- modify_param_paths(base_dir, workflow_params)¶
Modify the file paths in the input workflow parameters to be relative to base_dir.
- build_wes_request(workflow_file, workflow_params_file, attachments, workflow_engine_parameters=None)¶
Build the workflow run request to submit to WES.
- Parameters:
workflow_file (str) – The path or URL to the CWL workflow document. Only file:// URL supported at the moment.
workflow_params_file (Optional[str]) – The path or URL to the CWL input file.
attachments (Optional[list[str]]) – A list of local paths to files that will be uploaded to the server.
workflow_engine_parameters (Optional[list[str]]) – A list of engine parameters to set along with this workflow run.
- Returns:
A dictionary of parameters as the body of the request, and an iterable for the pairs of filename and file contents to upload to the server.
- Return type:
tuple[dict[str, str], collections.abc.Iterable[tuple[str, tuple[str, io.BytesIO]]]]
- run_with_engine_options(workflow_file, workflow_params_file, attachments, workflow_engine_parameters)¶
Composes and sends a post request that signals the WES server to run a workflow.
- Parameters:
workflow_file (str) – The path to the CWL workflow document.
workflow_params_file (Optional[str]) – The path to the CWL input file.
attachments (Optional[list[str]]) – A list of local paths to files that will be uploaded to the server.
workflow_engine_parameters (Optional[list[str]]) – A list of engine parameters to set along with this workflow run.
- Returns:
The body of the post result as a dictionary.
- Return type:
- toil.server.cli.wes_cwl_runner.get_deps_from_cwltool(cwl_file, input_file=None)¶
Return a list of dependencies of the given workflow from cwltool.
- toil.server.cli.wes_cwl_runner.submit_run(client, cwl_file, input_file=None, engine_options=None)¶
Given a CWL file, its input files, and an optional list of engine options, submit the CWL workflow to the WES server via the WES client.
This function also attempts to find the attachments from the CWL workflow and its input file, and attach them to the WES run request.
- Parameters:
client (WESClientWithWorkflowEngineParameters) – The WES client.
cwl_file (str) – The path to the CWL workflow document.
input_file (Optional[str]) – The path to the CWL input file.
engine_options (Optional[list[str]]) – A list of engine parameters to set along with this workflow run.
- Return type:
- toil.server.cli.wes_cwl_runner.poll_run(client, run_id)¶
Return True if the given workflow run is in a finished state.
- Parameters:
run_id (str)
- Return type:
- toil.server.cli.wes_cwl_runner.print_logs_and_exit(client, run_id)¶
Fetch the workflow logs from the WES server, print the results, then exit the program with the same exit code as the workflow run.
- Parameters:
client (WESClientWithWorkflowEngineParameters) – The WES client.
run_id (str) – The run_id of the target workflow.
- Return type:
None
- toil.server.cli.wes_cwl_runner.main()¶
- Return type:
None