cwltool.builder

Command line builder.

Module Contents

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.

Attributes

INPUT_OBJ_VOCAB

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:
build_job_script(commands)
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[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[MutableMapping[str, str], Any]) –

Return type:

str

generate_arg(binding)
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]