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:
  • value (str)

  • replace (str)

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 (cwltool.utils.CWLObjectType)

  • files (list[cwltool.utils.CWLObjectType])

  • bindings (list[cwltool.utils.CWLObjectType])

  • schemaDefs (collections.abc.MutableMapping[str, cwltool.utils.CWLObjectType])

  • names (schema_salad.avro.schema.Names)

  • requirements (list[cwltool.utils.CWLObjectType])

  • hints (list[cwltool.utils.CWLObjectType])

  • resources (dict[str, Union[int, float]])

  • mutation_manager (Optional[cwltool.mutation.MutationManager])

  • formatgraph (Optional[rdflib.Graph])

  • make_fs_access (type[cwltool.stdfsaccess.StdFsAccess])

  • fs_access (cwltool.stdfsaccess.StdFsAccess)

  • job_script_provider (Optional[cwltool.software_requirements.DependenciesConfiguration])

  • timeout (float)

  • debug (bool)

  • js_console (bool)

  • force_docker_pull (bool)

  • loadListing (cwltool.utils.LoadListingType)

  • outdir (str)

  • tmpdir (str)

  • stagedir (str)

  • cwlVersion (str)

  • container_engine (str)

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]