cwltool.main

Entry point for cwltool.

Module Contents

Classes

ProvLogFormatter

Enforce ISO8601 with both T and Z.

Functions

generate_example_input(inptype, default)

Convert a single input schema into an example.

realize_input_schema(input_types, schema_defs)

Replace references to named typed with the actual types.

generate_input_template(tool)

Generate an example input object for the given CWL process.

load_job_order(args, stdin, fetcher_constructor, overrides_list, tool_file_uri)

init_job_order(job_order_object, args, process, loader, stdout, print_input_deps = False, relative_deps = 'primary', make_fs_access = StdFsAccess, input_basedir = '', secret_store = None, input_required = True, runtime_context = None)

make_relative(base, obj)

Relativize the location URI of a File or Directory object.

printdeps(obj, document_loader, stdout, relative_deps, uri, basedir = None, nestdirs = True)

Print a JSON representation of the dependencies of the CWL document.

prov_deps(obj, document_loader, uri, basedir = None)

find_deps(obj, document_loader, uri, basedir = None, nestdirs = True)

Find the dependencies of the CWL document.

print_pack(loadingContext, uri)

Return a CWL serialization of the CWL document in JSON.

supported_cwl_versions(enable_dev)

setup_schema(args, custom_schema_callback)

setup_provenance(args, argsl, runtimeContext)

setup_loadingContext(loadingContext, runtimeContext, args)

Prepare a LoadingContext from the given arguments.

make_template(tool)

Make a template CWL input object for the give Process.

inherit_reqshints(tool, parent)

Copy down requirements and hints from ancestors of a given process.

choose_target(args, tool, loading_context)

Walk the Workflow, extract the subset matches all the args.targets.

choose_step(args, tool, loading_context)

Walk the given Workflow and extract just args.single_step.

choose_process(args, tool, loadingContext)

Walk the given Workflow and extract just args.single_process.

check_working_directories(runtimeContext)

Make any needed working directories.

print_targets(tool, stdout, loading_context, prefix = '')

Recursively find targets for --subgraph and friends.

main(argsl = None, args = None, job_order_object = None, stdin = sys.stdin, stdout = None, stderr = sys.stderr, versionfunc = versionstring, logger_handler = None, custom_schema_callback = None, executor = None, loadingContext = None, runtimeContext = None, input_required = True)

find_default_container(builder, default_container = None, use_biocontainers = None)

Find a container.

windows_check()

See if we are running on MS Windows and warn about the lack of support.

run(*args, **kwargs)

Run cwltool.

Attributes

ProvOut

cwltool.main.generate_example_input(inptype, default)

Convert a single input schema into an example.

Parameters
  • inptype (Optional[cwltool.utils.CWLOutputType]) –

  • default (Optional[cwltool.utils.CWLOutputType]) –

Return type

Tuple[Any, str]

cwltool.main.realize_input_schema(input_types, schema_defs)

Replace references to named typed with the actual types.

Parameters
  • input_types (MutableSequence[Union[str, cwltool.utils.CWLObjectType]]) –

  • schema_defs (MutableMapping[str, cwltool.utils.CWLObjectType]) –

Return type

MutableSequence[Union[str, cwltool.utils.CWLObjectType]]

cwltool.main.generate_input_template(tool)

Generate an example input object for the given CWL process.

Parameters

tool (cwltool.process.Process) –

Return type

cwltool.utils.CWLObjectType

cwltool.main.load_job_order(args, stdin, fetcher_constructor, overrides_list, tool_file_uri)
Parameters
  • args (argparse.Namespace) –

  • stdin (IO[Any]) –

  • fetcher_constructor (Optional[schema_salad.utils.FetcherCallableType]) –

  • overrides_list (List[cwltool.utils.CWLObjectType]) –

  • tool_file_uri (str) –

Return type

Tuple[Optional[cwltool.utils.CWLObjectType], str, schema_salad.ref_resolver.Loader]

cwltool.main.init_job_order(job_order_object, args, process, loader, stdout, print_input_deps=False, relative_deps='primary', make_fs_access=StdFsAccess, input_basedir='', secret_store=None, input_required=True, runtime_context=None)
Parameters
Return type

cwltool.utils.CWLObjectType

cwltool.main.make_relative(base, obj)

Relativize the location URI of a File or Directory object.

Parameters
  • base (str) –

  • obj (cwltool.utils.CWLObjectType) –

Return type

None

cwltool.main.printdeps(obj, document_loader, stdout, relative_deps, uri, basedir=None, nestdirs=True)

Print a JSON representation of the dependencies of the CWL document.

Parameters
  • obj (cwltool.utils.CWLObjectType) –

  • document_loader (schema_salad.ref_resolver.Loader) –

  • stdout (Union[TextIO, codecs.StreamWriter]) –

  • relative_deps (str) –

  • uri (str) –

  • basedir (Optional[str]) –

  • nestdirs (bool) –

Return type

None

cwltool.main.prov_deps(obj, document_loader, uri, basedir=None)
Parameters
  • obj (cwltool.utils.CWLObjectType) –

  • document_loader (schema_salad.ref_resolver.Loader) –

  • uri (str) –

  • basedir (Optional[str]) –

Return type

cwltool.utils.CWLObjectType

cwltool.main.find_deps(obj, document_loader, uri, basedir=None, nestdirs=True)

Find the dependencies of the CWL document.

Parameters
  • obj (cwltool.utils.CWLObjectType) –

  • document_loader (schema_salad.ref_resolver.Loader) –

  • uri (str) –

  • basedir (Optional[str]) –

  • nestdirs (bool) –

Return type

cwltool.utils.CWLObjectType

cwltool.main.print_pack(loadingContext, uri)

Return a CWL serialization of the CWL document in JSON.

Parameters
Return type

str

cwltool.main.supported_cwl_versions(enable_dev)
Parameters

enable_dev (bool) –

Return type

List[str]

cwltool.main.setup_schema(args, custom_schema_callback)
Parameters
  • args (argparse.Namespace) –

  • custom_schema_callback (Optional[Callable[[], None]]) –

Return type

None

class cwltool.main.ProvLogFormatter

Bases: logging.Formatter

Inheritance diagram of cwltool.main.ProvLogFormatter

Enforce ISO8601 with both T and Z.

formatTime(self, record, datefmt=None)

Return the creation time of the specified LogRecord as formatted text.

This method should be called from format() by a formatter which wants to make use of a formatted time. This method can be overridden in formatters to provide for any specific requirement, but the basic behaviour is as follows: if datefmt (a string) is specified, it is used with time.strftime() to format the creation time of the record. Otherwise, an ISO8601-like (or RFC 3339-like) format is used. The resulting string is returned. This function uses a user-configurable function to convert the creation time to a tuple. By default, time.localtime() is used; to change this for a particular formatter instance, set the ‘converter’ attribute to a function with the same signature as time.localtime() or time.gmtime(). To change it for all formatters, for example if you want all logging times to be shown in GMT, set the ‘converter’ attribute in the Formatter class.

Parameters
  • record (logging.LogRecord) –

  • datefmt (Optional[str]) –

Return type

str

cwltool.main.ProvOut
cwltool.main.setup_provenance(args, argsl, runtimeContext)
Parameters
Return type

Tuple[ProvOut, logging.StreamHandler[ProvOut]]

cwltool.main.setup_loadingContext(loadingContext, runtimeContext, args)

Prepare a LoadingContext from the given arguments.

Parameters
Return type

cwltool.context.LoadingContext

cwltool.main.make_template(tool)

Make a template CWL input object for the give Process.

Parameters

tool (cwltool.process.Process) –

Return type

None

cwltool.main.inherit_reqshints(tool, parent)

Copy down requirements and hints from ancestors of a given process.

Parameters
Return type

None

cwltool.main.choose_target(args, tool, loading_context)

Walk the Workflow, extract the subset matches all the args.targets.

Parameters
Return type

Optional[cwltool.process.Process]

cwltool.main.choose_step(args, tool, loading_context)

Walk the given Workflow and extract just args.single_step.

Parameters
Return type

Optional[cwltool.process.Process]

cwltool.main.choose_process(args, tool, loadingContext)

Walk the given Workflow and extract just args.single_process.

Parameters
Return type

Optional[cwltool.process.Process]

cwltool.main.check_working_directories(runtimeContext)

Make any needed working directories.

Parameters

runtimeContext (cwltool.context.RuntimeContext) –

Return type

Optional[int]

cwltool.main.print_targets(tool, stdout, loading_context, prefix='')

Recursively find targets for –subgraph and friends.

Parameters
Return type

None

cwltool.main.main(argsl=None, args=None, job_order_object=None, stdin=sys.stdin, stdout=None, stderr=sys.stderr, versionfunc=versionstring, logger_handler=None, custom_schema_callback=None, executor=None, loadingContext=None, runtimeContext=None, input_required=True)
Parameters
  • argsl (Optional[List[str]]) –

  • args (Optional[argparse.Namespace]) –

  • job_order_object (Optional[cwltool.utils.CWLObjectType]) –

  • stdin (IO[Any]) –

  • stdout (Optional[Union[TextIO, codecs.StreamWriter]]) –

  • stderr (IO[Any]) –

  • versionfunc (Callable[[], str]) –

  • logger_handler (Optional[logging.Handler]) –

  • custom_schema_callback (Optional[Callable[[], None]]) –

  • executor (Optional[cwltool.executors.JobExecutor]) –

  • loadingContext (Optional[cwltool.context.LoadingContext]) –

  • runtimeContext (Optional[cwltool.context.RuntimeContext]) –

  • input_required (bool) –

Return type

int

cwltool.main.find_default_container(builder, default_container=None, use_biocontainers=None)

Find a container.

Parameters
Return type

Optional[str]

cwltool.main.windows_check()

See if we are running on MS Windows and warn about the lack of support.

Return type

None

cwltool.main.run(*args, **kwargs)

Run cwltool.

Parameters
  • args (Any) –

  • kwargs (Any) –

Return type

None