cwltool.command_line_tool
Implementation of CommandLineTool.
Attributes
Exceptions
Common base class for all non-exit exceptions. |
Classes
What characters are allowed in path names. |
|
Job for |
|
Abstract CWL Process. |
|
Abstract CWL Process. |
|
Callback Job class, used by |
|
Abstract CWL Process. |
Functions
|
Remove any 'path' property, if present. |
|
Remap a file from internal path to external path. |
|
Map files to assigned path inside a container. |
|
|
|
Build a |
Module Contents
- class cwltool.command_line_tool.PathCheckingMode(*args, **kwds)
Bases:
enum.Enum
What characters are allowed in path names.
We have the strict (default) mode and the relaxed mode.
- STRICT
Accepts names that contain one or more of the following:
\wunicode word characters
this includes most characters that can be part of a word in any language, as well as numbers and the underscore
.a literal period
+a literal plus sign
,a literal comma
-a literal minus sign
:a literal colon
@a literal at-symbol
]a literal end-square-bracket
^a literal caret symbol
\u2600-\u26FFmatches a single character in the range between ☀ (index 9728) and ⛿ (index 9983)
\U0001f600-\U0001f64fmatches a single character in the range between 😀 (index 128512) and 🙏 (index 128591)
Note: the following characters are intentionally not included:
reserved words in POSIX:
!,{,}POSIX metacharacters listed in the CWL standard as okay to reject:
|,&,;,<,>,(,),$,`,",', <space>, <tab>, <newline>.(In accordance with https://www.commonwl.org/v1.0/CommandLineTool.html#File under “path” )
POSIX path separator:
\(also listed at https://www.commonwl.org/v1.0/CommandLineTool.html#File under “path”)
Additional POSIX metacharacters:
*,?,[,#,˜,=,%.
TODO: switch to https://pypi.org/project/regex/ and use
\p{Extended_Pictographic}instead of the manual emoji ranges
- RELAXED
Accept anything.
- class cwltool.command_line_tool.ExpressionJob(builder, script, output_callback, requirements, hints, outdir=None, tmpdir=None)
Job for
ExpressionTool.- Parameters:
builder (cwltool.builder.Builder)
script (str)
output_callback (cwltool.utils.OutputCallbackType | None)
requirements (list[cwl_utils.types.CWLObjectType])
hints (list[cwl_utils.types.CWLObjectType])
outdir (str | None)
tmpdir (str | None)
- builder
- requirements
- hints
- output_callback
- outdir = None
- tmpdir = None
- script
- prov_obj: cwltool.cwlprov.provenance_profile.ProvenanceProfile | None = None
- run(runtimeContext, tmpdir_lock=None)
- Parameters:
runtimeContext (cwltool.context.RuntimeContext)
tmpdir_lock (Union[threading.Lock, None])
- Return type:
None
- class cwltool.command_line_tool.ExpressionTool(toolpath_object, loadingContext)
Bases:
cwltool.process.Process
Abstract CWL Process.
- Parameters:
toolpath_object (ruamel.yaml.comments.CommentedMap)
loadingContext (cwltool.context.LoadingContext)
- job(job_order, output_callbacks, runtimeContext)
- Parameters:
job_order (cwl_utils.types.CWLObjectType)
output_callbacks (cwltool.utils.OutputCallbackType | None)
runtimeContext (cwltool.context.RuntimeContext)
- Return type:
collections.abc.Generator[ExpressionJob, None, None]
- class cwltool.command_line_tool.AbstractOperation(toolpath_object, loadingContext)
Bases:
cwltool.process.Process
Abstract CWL Process.
- Parameters:
toolpath_object (ruamel.yaml.comments.CommentedMap)
loadingContext (cwltool.context.LoadingContext)
- job(job_order, output_callbacks, runtimeContext)
- Parameters:
job_order (cwl_utils.types.CWLObjectType)
output_callbacks (cwltool.utils.OutputCallbackType | None)
runtimeContext (cwltool.context.RuntimeContext)
- Return type:
- cwltool.command_line_tool.remove_path(f)
Remove any ‘path’ property, if present.
- Parameters:
f (cwl_utils.types.CWLFileType | cwl_utils.types.CWLDirectoryType)
- Return type:
None
- cwltool.command_line_tool.revmap_file(builder, outdir, f)
Remap a file from internal path to external path.
For Docker, this maps from the path inside tho container to the path outside the container. Recognizes files in the pathmapper or remaps internal output directories to the external directory.
- Parameters:
builder (cwltool.builder.Builder)
outdir (str)
f (cwl_utils.types.CWLFileType | cwl_utils.types.CWLDirectoryType)
- Return type:
cwl_utils.types.CWLFileType | cwl_utils.types.CWLDirectoryType
- class cwltool.command_line_tool.CallbackJob(job, output_callback, cachebuilder, jobcache)
Callback Job class, used by
CommandLineTool.job().- Parameters:
job (CommandLineTool)
output_callback (cwltool.utils.OutputCallbackType | None)
cachebuilder (cwltool.builder.Builder)
jobcache (str)
- job
- output_callback
- cachebuilder
- outdir
- prov_obj: cwltool.cwlprov.provenance_profile.ProvenanceProfile | None = None
- run(runtimeContext, tmpdir_lock=None)
- Parameters:
runtimeContext (cwltool.context.RuntimeContext)
tmpdir_lock (Union[threading.Lock, None])
- Return type:
None
- cwltool.command_line_tool.check_adjust(accept_re, builder, file_o)
Map files to assigned path inside a container.
We need to also explicitly walk over input, as implicit reassignment doesn’t reach everything in builder.bindings
- Parameters:
accept_re (re.Pattern[str])
builder (cwltool.builder.Builder)
file_o (cwl_utils.types.CWLFileType | cwl_utils.types.CWLDirectoryType)
- Return type:
cwl_utils.types.CWLFileType | cwl_utils.types.CWLDirectoryType
- cwltool.command_line_tool.check_valid_locations(fs_access, ob)
- Parameters:
fs_access (cwltool.stdfsaccess.StdFsAccess)
- Return type:
None
- cwltool.command_line_tool.OutputPortsType
- exception cwltool.command_line_tool.ParameterOutputWorkflowException(msg, port)
Bases:
cwltool.errors.WorkflowException
Common base class for all non-exit exceptions.
- Parameters:
msg (str)
- msg
- port
- cwltool.command_line_tool.default_make_path_mapper(reffiles, stagedir, runtimeContext, separateDirs)
Build a
PathMapperfor the given inputs.The concrete class is taken from
path_mapper(defaulting toPathMapper), so a customPathMappercan be supplied by setting that attribute on theRuntimeContext– mirroring themake_fs_accessextension point – without subclassingCommandLineTool.- Parameters:
reffiles (collections.abc.MutableSequence[cwl_utils.types.CWLFileType | cwl_utils.types.CWLDirectoryType])
stagedir (str)
runtimeContext (cwltool.context.RuntimeContext)
separateDirs (bool)
- Return type:
- class cwltool.command_line_tool.CommandLineTool(toolpath_object, loadingContext)
Bases:
cwltool.process.Process
Abstract CWL Process.
- Parameters:
toolpath_object (ruamel.yaml.comments.CommentedMap)
loadingContext (cwltool.context.LoadingContext)
- prov_obj
- path_check_mode: PathCheckingMode
- make_job_runner(runtimeContext)
Return the correct CommandLineJob class given the container settings.
- Parameters:
runtimeContext (cwltool.context.RuntimeContext)
- Return type:
- make_path_mapper(reffiles, stagedir, runtimeContext, separateDirs)
Create the
PathMapperfor these inputs.Delegates to
default_make_path_mapper(), which selects the concretePathMapperclass frompath_mapper. This is an instance method (not a@staticmethod) so that subclasses ofCommandLineToolmay override it; being a regular method it also dispatches correctly when cwltool is compiled with mypyc.- Parameters:
reffiles (collections.abc.MutableSequence[cwl_utils.types.CWLFileType | cwl_utils.types.CWLDirectoryType])
stagedir (str)
runtimeContext (cwltool.context.RuntimeContext)
separateDirs (bool)
- Return type:
- updatePathmap(outdir, pathmap, fn)
Update a PathMapper with a CWL File or Directory object.
- Parameters:
outdir (str)
pathmap (cwltool.pathmapper.PathMapper)
fn (cwl_utils.types.CWLFileType | cwl_utils.types.CWLDirectoryType)
- Return type:
None
- job(job_order, output_callbacks, runtimeContext)
- Parameters:
job_order (cwl_utils.types.CWLObjectType)
output_callbacks (cwltool.utils.OutputCallbackType)
runtimeContext (cwltool.context.RuntimeContext)
- Return type:
collections.abc.Generator[cwltool.job.JobBase | CallbackJob, None, None]
- collect_output_ports(ports, builder, outdir, rcode, compute_checksum=True, jobname='', readers=None)
- Parameters:
ports (ruamel.yaml.comments.CommentedSeq | set[cwl_utils.types.CWLObjectType])
builder (cwltool.builder.Builder)
outdir (str)
rcode (int)
compute_checksum (bool)
jobname (str)
readers (collections.abc.MutableMapping[str, cwl_utils.types.CWLFileType | cwl_utils.types.CWLDirectoryType] | None)
- Return type:
- collect_output(schema, builder, outdir, fs_access, compute_checksum=True)
- Parameters:
schema (cwl_utils.types.CWLObjectType)
builder (cwltool.builder.Builder)
outdir (str)
fs_access (cwltool.stdfsaccess.StdFsAccess)
compute_checksum (bool)
- Return type: