cwltool.main
¶
Entry point for cwltool.
Module Contents¶
Classes¶
Enforce ISO8601 with both T and Z. |
Functions¶
|
Convert a single input schema into an example. |
|
Replace references to named typed with the actual types. |
|
Generate an example input object for the given CWL process. |
|
|
|
|
|
Relativize the location URI of a File or Directory object. |
|
Print a JSON representation of the dependencies of the CWL document. |
|
|
|
Find the dependencies of the CWL document. |
|
Return a CWL serialization of the CWL document in JSON. |
|
|
|
|
|
|
|
Prepare a LoadingContext from the given arguments. |
|
Make a template CWL input object for the give Process. |
|
Copy down requirements and hints from ancestors of a given process. |
|
Walk the Workflow, extract the subset matches all the args.targets. |
|
Walk the given Workflow and extract just args.single_step. |
|
Walk the given Workflow and extract just args.single_process. |
|
Make any needed working directories. |
|
Recursively find targets for --subgraph and friends. |
|
|
|
Find a container. |
See if we are running on MS Windows and warn about the lack of support. |
|
|
Run cwltool. |
Attributes¶
- 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
job_order_object (Optional[cwltool.utils.CWLObjectType]) –
args (argparse.Namespace) –
process (cwltool.process.Process) –
loader (schema_salad.ref_resolver.Loader) –
stdout (Union[TextIO, codecs.StreamWriter]) –
print_input_deps (bool) –
relative_deps (str) –
make_fs_access (Callable[[str], cwltool.stdfsaccess.StdFsAccess]) –
input_basedir (str) –
secret_store (Optional[cwltool.secrets.SecretStore]) –
input_required (bool) –
runtime_context (Optional[cwltool.context.RuntimeContext]) –
- 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
loadingContext (cwltool.context.LoadingContext) –
uri (str) –
- 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
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
args (argparse.Namespace) –
argsl (List[str]) –
runtimeContext (cwltool.context.RuntimeContext) –
- Return type
Tuple[ProvOut, logging.StreamHandler[ProvOut]]
- cwltool.main.setup_loadingContext(loadingContext, runtimeContext, args)¶
Prepare a LoadingContext from the given arguments.
- Parameters
loadingContext (Optional[cwltool.context.LoadingContext]) –
runtimeContext (cwltool.context.RuntimeContext) –
args (argparse.Namespace) –
- Return type
- 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
tool (cwltool.process.Process) –
parent (cwltool.process.Process) –
- Return type
None
- cwltool.main.choose_target(args, tool, loading_context)¶
Walk the Workflow, extract the subset matches all the args.targets.
- Parameters
args (argparse.Namespace) –
tool (cwltool.process.Process) –
loading_context (cwltool.context.LoadingContext) –
- 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
args (argparse.Namespace) –
tool (cwltool.process.Process) –
loading_context (cwltool.context.LoadingContext) –
- Return type
Optional[cwltool.process.Process]
- cwltool.main.choose_process(args, tool, loadingContext)¶
Walk the given Workflow and extract just args.single_process.
- Parameters
args (argparse.Namespace) –
tool (cwltool.process.Process) –
loadingContext (cwltool.context.LoadingContext) –
- 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
tool (cwltool.process.Process) –
stdout (Union[TextIO, codecs.StreamWriter]) –
loading_context (cwltool.context.LoadingContext) –
prefix (str) –
- 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
builder (cwltool.utils.HasReqsHints) –
default_container (Optional[str]) –
use_biocontainers (Optional[bool]) –
- 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