# cwltool.context

Shared context objects that replace use of kwargs.

## Attributes

`default_make_tool` |

## Classes

`ContextBase` | Shared kwargs based initializer for `RuntimeContext` and `LoadingContext`.
`LoadingContext` | Shared kwargs based initializer for `RuntimeContext` and `LoadingContext`.
`RuntimeContext` | Shared kwargs based initializer for `RuntimeContext` and `LoadingContext`.

## Functions

`make_tool_notimpl`(toolpath_object, loadingContext) | Fake implementation of the make tool function.
`log_handler`(outdir, base_path_logs, stdout_path, ...) | Move logs from log location to final output.
`set_log_dir`(outdir, log_dir, subdir_name) | Set the log directory.
`getdefault`(val, default) | Return the `val` using the `default` as backup in case the val is `None`.

## Module Contents

class cwltool.context.ContextBase(kwargs=None)

  Shared kwargs based initializer for `RuntimeContext` and `LoadingContext`.

  Parameters:

    kwargs (dict[str, Any] | None)

cwltool.context.make_tool_notimpl(toolpath_object, loadingContext)

  Fake implementation of the make tool function.

  Parameters:

    - toolpath_object (ruamel.yaml.comments.CommentedMap)

    - loadingContext (LoadingContext)

  Return type:

    cwltool.process.Process

cwltool.context.default_make_tool

cwltool.context.log_handler(outdir, base_path_logs, stdout_path, stderr_path)

  Move logs from log location to final output.

  Parameters:

    - outdir (str)

    - base_path_logs (str)

    - stdout_path (str | None)

    - stderr_path (str | None)

  Return type:

    None

cwltool.context.set_log_dir(outdir, log_dir, subdir_name)

  Set the log directory.

  Parameters:

    - outdir (str)

    - log_dir (str)

    - subdir_name (str)

  Return type:

    str

class cwltool.context.LoadingContext(kwargs=None)

  Bases: `ContextBase`

  Shared kwargs based initializer for `RuntimeContext` and `LoadingContext`.

  Parameters:

    kwargs (dict[str, Any] | None)

  debug: bool = False
  metadata: cwltool.utils.CWLObjectType
  requirements: list[cwltool.utils.CWLObjectType] | None = None
  hints: list[cwltool.utils.CWLObjectType] | None = None
  overrides_list: list[cwltool.utils.CWLObjectType] = []
  loader: schema_salad.ref_resolver.Loader | None = None
  avsc_names: schema_salad.avro.schema.Names | None = None
  disable_js_validation: bool = False
  js_hint_options_file: str | None = None
  do_validate: bool = True
  enable_dev: bool = False
  strict: bool = True
  resolver: cwltool.utils.ResolverType | None = None
  fetcher_constructor: schema_salad.utils.FetcherCallableType | None = None
  construct_tool_object
  orcid: str = ''
  cwl_full_name: str = ''
  host_provenance: bool = False
  user_provenance: bool = False
  do_update: bool | None = None
  jobdefaults: ruamel.yaml.comments.CommentedMap | None = None
  doc_cache: bool = True
  relax_path_checks: bool = False
  singularity: bool = False
  podman: bool = False
  eval_timeout: float = 60
  codegen_idx: dict[str, tuple[Any, cwl_utils.parser.cwl_v1_2.LoadingOptions]]
  fast_parser = False
  skip_resolve_all = False
  skip_schemas = False
  copy()

    Return a copy of this `LoadingContext`.

    Return type:

      LoadingContext

class cwltool.context.RuntimeContext(kwargs=None)

  Bases: `ContextBase`

  Shared kwargs based initializer for `RuntimeContext` and `LoadingContext`.

  Parameters:

    kwargs (dict[str, Any] | None)

  outdir: str | None = None
  tmpdir: str = ''
  tmpdir_prefix: str
  tmp_outdir_prefix: str = ''
  stagedir: str = ''
  user_space_docker_cmd: str | None = None
  secret_store: cwltool.secrets.SecretStore | None = None
  no_read_only: bool = False
  custom_net: str | None = None
  no_match_user: bool = False
  preserve_environment: collections.abc.Iterable[str] | None = None
  preserve_entire_environment: bool = False
  use_container: bool = True
  force_docker_pull: bool = False
  rm_tmpdir: bool = True
  pull_image: bool = True
  rm_container: bool = True
  move_outputs: Literal['move'] | Literal['leave'] | Literal['copy'] = 'move'
  log_dir: str = ''
  set_log_dir
  log_dir_handler
  streaming_allowed: bool = False
  singularity: bool = False
  image_base_path: str | None = None
  podman: bool = False
  debug: bool = False
  compute_checksum: bool = True
  name: str = ''
  default_container: str | None = ''
  find_default_container: collections.abc.Callable[[cwltool.utils.HasReqsHints], str | None] | None = None
  cachedir: str | None = None
  part_of: str = ''
  basedir: str = ''
  toplevel: bool = False
  mutation_manager: cwltool.mutation.MutationManager | None = None
  make_fs_access
  path_mapper
  builder: cwltool.builder.Builder | None = None
  docker_outdir: str = ''
  docker_tmpdir: str = ''
  docker_stagedir: str = ''
  js_console: bool = False
  job_script_provider: cwltool.software_requirements.DependenciesConfiguration | None = None
  select_resources: RuntimeContext.__init__.select_resources_callable | None = None
  eval_timeout: float = 60
  postScatterEval: collections.abc.Callable[[cwltool.utils.CWLObjectType], cwltool.utils.CWLObjectType | None] | None = None
  on_error: Literal['stop'] | Literal['continue'] = 'stop'
  strict_memory_limit: bool = False
  strict_cpu_limit: bool = False
  cidfile_dir: str | None = None
  cidfile_prefix: str | None = None
  workflow_eval_lock: threading.Condition | None = None
  orcid: str = ''
  cwl_full_name: str = ''
  process_run_id: str | None = None
  prov_host: bool = False
  prov_user: bool = False
  mpi_config: cwltool.mpi.MpiConfig
  default_stdout: IO[bytes] | TextIO | None = None
  default_stderr: IO[bytes] | TextIO | None = None
  validate_only: bool = False
  validate_stdout: SupportsWrite[str] | None = None
  workflow_job_step_name_callback: None | collections.abc.Callable[[cwltool.workflow_job.WorkflowJobStep, cwltool.utils.CWLObjectType], str] = None
  get_outdir()

    Return `outdir` or create one with `tmp_outdir_prefix`.

    Return type:

      str

  get_tmpdir()

    Return `tmpdir` or create one with `tmpdir_prefix`.

    Return type:

      str

  get_stagedir()

    Return `stagedir` or create one with `tmpdir_prefix`.

    Return type:

      str

  create_tmpdir()

    Create a temporary directory that respects `tmpdir_prefix`.

    Return type:

      str

  create_outdir()

    Create a temporary directory that respects `tmp_outdir_prefix`.

    Return type:

      str

  copy()

    Return a copy of this `RuntimeContext`.

    Return type:

      RuntimeContext

cwltool.context.getdefault(val, default)

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

  Parameters:

    - val (Any)

    - default (Any)

  Return type:

    Any