cwltool.context
===============

.. py:module:: cwltool.context

.. autoapi-nested-parse::

   Shared context objects that replace use of kwargs.



Attributes
----------

.. autoapisummary::

   cwltool.context.default_make_tool


Classes
-------

.. autoapisummary::

   cwltool.context.ContextBase
   cwltool.context.LoadingContext
   cwltool.context.RuntimeContext


Functions
---------

.. autoapisummary::

   cwltool.context.make_tool_notimpl
   cwltool.context.log_handler
   cwltool.context.set_log_dir
   cwltool.context.getdefault


Module Contents
---------------

.. py:class:: ContextBase(kwargs = None)

   Shared kwargs based initializer for :py:class:`RuntimeContext` and :py:class:`LoadingContext`.


.. py:function:: make_tool_notimpl(toolpath_object, loadingContext)

   Fake implementation of the make tool function.


.. py:data:: default_make_tool

.. py:function:: log_handler(outdir, base_path_logs, stdout_path, stderr_path)

   Move logs from log location to final output.


.. py:function:: set_log_dir(outdir, log_dir, subdir_name)

   Set the log directory.


.. py:class:: LoadingContext(kwargs = None)

   Bases: :py:obj:`ContextBase`

   .. autoapi-inheritance-diagram:: cwltool.context.LoadingContext
      :parts: 1


   Shared kwargs based initializer for :py:class:`RuntimeContext` and :py:class:`LoadingContext`.


   .. py:attribute:: debug
      :type:  bool
      :value: False



   .. py:attribute:: metadata
      :type:  cwl_utils.types.CWLObjectType


   .. py:attribute:: requirements
      :type:  list[cwl_utils.types.CWLObjectType] | None
      :value: None



   .. py:attribute:: hints
      :type:  list[cwl_utils.types.CWLObjectType] | None
      :value: None



   .. py:attribute:: overrides_list
      :type:  list[cwl_utils.types.CWLObjectType]
      :value: []



   .. py:attribute:: loader
      :type:  schema_salad.ref_resolver.Loader | None
      :value: None



   .. py:attribute:: avsc_names
      :type:  schema_salad.avro.schema.Names | None
      :value: None



   .. py:attribute:: disable_js_validation
      :type:  bool
      :value: False



   .. py:attribute:: js_hint_options_file
      :type:  str | None
      :value: None



   .. py:attribute:: do_validate
      :type:  bool
      :value: True



   .. py:attribute:: enable_dev
      :type:  bool
      :value: False



   .. py:attribute:: strict
      :type:  bool
      :value: True



   .. py:attribute:: resolver
      :type:  cwltool.utils.ResolverType | None
      :value: None



   .. py:attribute:: fetcher_constructor
      :type:  schema_salad.utils.FetcherCallableType | None
      :value: None



   .. py:attribute:: construct_tool_object


   .. py:attribute:: orcid
      :type:  str
      :value: ''



   .. py:attribute:: cwl_full_name
      :type:  str
      :value: ''



   .. py:attribute:: host_provenance
      :type:  bool
      :value: False



   .. py:attribute:: user_provenance
      :type:  bool
      :value: False



   .. py:attribute:: do_update
      :type:  bool | None
      :value: None



   .. py:attribute:: jobdefaults
      :type:  ruamel.yaml.comments.CommentedMap | None
      :value: None



   .. py:attribute:: doc_cache
      :type:  bool
      :value: True



   .. py:attribute:: relax_path_checks
      :type:  bool
      :value: False



   .. py:attribute:: singularity
      :type:  bool
      :value: False



   .. py:attribute:: podman
      :type:  bool
      :value: False



   .. py:attribute:: eval_timeout
      :type:  float
      :value: 60



   .. py:attribute:: codegen_idx
      :type:  dict[str, tuple[Any, cwl_utils.parser.cwl_v1_2.LoadingOptions]]


   .. py:attribute:: fast_parser
      :value: False



   .. py:attribute:: skip_resolve_all
      :value: False



   .. py:attribute:: skip_schemas
      :value: False



   .. py:method:: copy()

      Return a copy of this :py:class:`LoadingContext`.



.. py:class:: RuntimeContext(kwargs = None)

   Bases: :py:obj:`ContextBase`

   .. autoapi-inheritance-diagram:: cwltool.context.RuntimeContext
      :parts: 1


   Shared kwargs based initializer for :py:class:`RuntimeContext` and :py:class:`LoadingContext`.


   .. py:attribute:: outdir
      :type:  str | None
      :value: None



   .. py:attribute:: tmpdir
      :type:  str
      :value: ''



   .. py:attribute:: tmpdir_prefix
      :type:  str


   .. py:attribute:: tmp_outdir_prefix
      :type:  str
      :value: ''



   .. py:attribute:: stagedir
      :type:  str
      :value: ''



   .. py:attribute:: user_space_docker_cmd
      :type:  str | None
      :value: None



   .. py:attribute:: secret_store
      :type:  Optional[cwltool.secrets.SecretStore]
      :value: None



   .. py:attribute:: no_read_only
      :type:  bool
      :value: False



   .. py:attribute:: custom_net
      :type:  str | None
      :value: None



   .. py:attribute:: no_match_user
      :type:  bool
      :value: False



   .. py:attribute:: preserve_environment
      :type:  collections.abc.Iterable[str] | None
      :value: None



   .. py:attribute:: preserve_entire_environment
      :type:  bool
      :value: False



   .. py:attribute:: use_container
      :type:  bool
      :value: True



   .. py:attribute:: force_docker_pull
      :type:  bool
      :value: False



   .. py:attribute:: rm_tmpdir
      :type:  bool
      :value: True



   .. py:attribute:: pull_image
      :type:  bool
      :value: True



   .. py:attribute:: rm_container
      :type:  bool
      :value: True



   .. py:attribute:: move_outputs
      :type:  Literal['move'] | Literal['leave'] | Literal['copy']
      :value: 'move'



   .. py:attribute:: log_dir
      :type:  str
      :value: ''



   .. py:attribute:: set_log_dir


   .. py:attribute:: log_dir_handler


   .. py:attribute:: streaming_allowed
      :type:  bool
      :value: False



   .. py:attribute:: singularity
      :type:  bool
      :value: False



   .. py:attribute:: image_base_path
      :type:  str | None
      :value: None



   .. py:attribute:: podman
      :type:  bool
      :value: False



   .. py:attribute:: debug
      :type:  bool
      :value: False



   .. py:attribute:: compute_checksum
      :type:  bool
      :value: True



   .. py:attribute:: name
      :type:  str
      :value: ''



   .. py:attribute:: default_container
      :type:  str | None
      :value: ''



   .. py:attribute:: find_default_container
      :type:  collections.abc.Callable[[cwltool.utils.HasReqsHints], str | None] | None
      :value: None



   .. py:attribute:: cachedir
      :type:  str | None
      :value: None



   .. py:attribute:: part_of
      :type:  str
      :value: ''



   .. py:attribute:: basedir
      :type:  str
      :value: ''



   .. py:attribute:: toplevel
      :type:  bool
      :value: False



   .. py:attribute:: mutation_manager
      :type:  Optional[cwltool.mutation.MutationManager]
      :value: None



   .. py:attribute:: make_fs_access


   .. py:attribute:: path_mapper


   .. py:attribute:: builder
      :type:  Optional[cwltool.builder.Builder]
      :value: None



   .. py:attribute:: docker_outdir
      :type:  str
      :value: ''



   .. py:attribute:: docker_tmpdir
      :type:  str
      :value: ''



   .. py:attribute:: docker_stagedir
      :type:  str
      :value: ''



   .. py:attribute:: js_console
      :type:  bool
      :value: False



   .. py:attribute:: job_script_provider
      :type:  cwltool.software_requirements.DependenciesConfiguration | None
      :value: None



   .. py:attribute:: select_resources
      :type:  RuntimeContext.__init__.select_resources_callable | None
      :value: None



   .. py:attribute:: eval_timeout
      :type:  float
      :value: 60



   .. py:attribute:: postScatterEval
      :type:  collections.abc.Callable[[cwl_utils.types.CWLObjectType], cwl_utils.types.CWLObjectType | None] | None
      :value: None



   .. py:attribute:: on_error
      :type:  Literal['stop'] | Literal['continue']
      :value: 'stop'



   .. py:attribute:: strict_memory_limit
      :type:  bool
      :value: False



   .. py:attribute:: strict_cpu_limit
      :type:  bool
      :value: False



   .. py:attribute:: cidfile_dir
      :type:  str | None
      :value: None



   .. py:attribute:: cidfile_prefix
      :type:  str | None
      :value: None



   .. py:attribute:: workflow_eval_lock
      :type:  Union[threading.Condition, None]
      :value: None



   .. py:attribute:: orcid
      :type:  str
      :value: ''



   .. py:attribute:: cwl_full_name
      :type:  str
      :value: ''



   .. py:attribute:: process_run_id
      :type:  str | None
      :value: None



   .. py:attribute:: prov_host
      :type:  bool
      :value: False



   .. py:attribute:: prov_user
      :type:  bool
      :value: False



   .. py:attribute:: mpi_config
      :type:  cwltool.mpi.MpiConfig


   .. py:attribute:: default_stdout
      :type:  IO[bytes] | TextIO | None
      :value: None



   .. py:attribute:: default_stderr
      :type:  IO[bytes] | TextIO | None
      :value: None



   .. py:attribute:: validate_only
      :type:  bool
      :value: False



   .. py:attribute:: validate_stdout
      :type:  Optional[SupportsWrite[str]]
      :value: None



   .. py:attribute:: workflow_job_step_name_callback
      :type:  None | collections.abc.Callable[[cwltool.workflow_job.WorkflowJobStep, cwl_utils.types.CWLObjectType], str]
      :value: None



   .. py:method:: get_outdir()

      Return :py:attr:`outdir` or create one with :py:attr:`tmp_outdir_prefix`.



   .. py:method:: get_tmpdir()

      Return :py:attr:`tmpdir` or create one with :py:attr:`tmpdir_prefix`.



   .. py:method:: get_stagedir()

      Return :py:attr:`stagedir` or create one with :py:attr:`tmpdir_prefix`.



   .. py:method:: create_tmpdir()

      Create a temporary directory that respects :py:attr:`tmpdir_prefix`.



   .. py:method:: create_outdir()

      Create a temporary directory that respects :py:attr:`tmp_outdir_prefix`.



   .. py:method:: copy()

      Return a copy of this :py:class:`RuntimeContext`.



.. py:function:: getdefault(val, default)

   Return the ``val`` using the ``default`` as backup in case the val is ``None``.


