cwltool.builder

Command line builder.

Attributes

INPUT_OBJ_VOCAB

Classes

Builder

Helper class to construct a command line from a CWL CommandLineTool.

Functions

content_limit_respected_read_bytes(f)

Read a file as bytes, respecting the CONTENT_LIMIT.

content_limit_respected_read(f)

Read a file as a string, respecting the CONTENT_LIMIT.

substitute(value, replace)

Perform CWL SecondaryFilesDSL style substitution.

Module Contents

cwltool.builder.INPUT_OBJ_VOCAB: dict[str, str]
cwltool.builder.content_limit_respected_read_bytes(f)

Read a file as bytes, respecting the CONTENT_LIMIT.

Parameters:

f (IO[bytes]) – file handle

Returns:

the file contents

Raises:

WorkflowException – if the file is too large

Return type:

bytes

cwltool.builder.content_limit_respected_read(f)

Read a file as a string, respecting the CONTENT_LIMIT.

Parameters:

f (IO[bytes]) – file handle

Returns:

the file contents

Raises:

WorkflowException – if the file is too large

Return type:

str

cwltool.builder.substitute(value, replace)

Perform CWL SecondaryFilesDSL style substitution.

Parameters:
Return type:

str

class cwltool.builder.Builder(job, files, bindings, schemaDefs, names, requirements, hints, resources, mutation_manager, formatgraph, make_fs_access, fs_access, job_script_provider, timeout, debug, js_console, force_docker_pull, loadListing, outdir, tmpdir, stagedir, cwlVersion, container_engine)

Bases: cwltool.utils.HasReqsHints

Inheritance diagram of cwltool.builder.Builder

Helper class to construct a command line from a CWL CommandLineTool.

Parameters:
job
files
bindings
schemaDefs
names
requirements
hints
resources
mutation_manager
formatgraph
make_fs_access
fs_access
job_script_provider
timeout
debug
js_console
force_docker_pull
loadListing
outdir
tmpdir
stagedir
cwlVersion
pathmapper: cwltool.pathmapper.PathMapper | None = None
prov_obj: cwltool.cwlprov.provenance_profile.ProvenanceProfile | None = None
find_default_container: Callable[[], str] | None = None
container_engine
build_job_script(commands)

Use the job_script_provider to turn the commands into a job script.

Parameters:

commands (list[str])

Return type:

Optional[str]

bind_input(schema, datum, discover_secondaryFiles, lead_pos=None, tail_pos=None)

Bind an input object to the command line.

Raises:
  • ValidationException – in the event of an invalid type union

  • WorkflowException – if a CWL Expression (“position”, “required”, “pattern”, “format”) evaluates to the wrong type or if a required secondary file is missing

Parameters:
  • schema (cwltool.utils.CWLObjectType)

  • datum (Union[cwltool.utils.CWLObjectType, list[cwltool.utils.CWLObjectType]])

  • discover_secondaryFiles (bool)

  • lead_pos (Optional[Union[int, list[int]]])

  • tail_pos (Optional[Union[str, list[int]]])

Return type:

list[collections.abc.MutableMapping[str, Union[str, list[int]]]]

tostr(value)

Represent an input parameter as a string.

Raises:

WorkflowException – if the item is a File or Directory and the “path” is missing.

Parameters:

value (Union[collections.abc.MutableMapping[str, str], Any])

Return type:

str

generate_arg(binding)

Convert an input binding to a list of command line arguments.

Parameters:

binding (cwltool.utils.CWLObjectType)

Return type:

list[str]

do_eval(ex, context=None, recursive=False, strip_whitespace=True)
Parameters:
  • ex (Optional[cwltool.utils.CWLOutputType])

  • context (Optional[Any])

  • recursive (bool)

  • strip_whitespace (bool)

Return type:

Optional[cwltool.utils.CWLOutputType]