1 # Copyright (C) The Arvados Authors. All rights reserved.
3 # SPDX-License-Identifier: Apache-2.0
5 from cwltool.context import LoadingContext, RuntimeContext
6 from collections import namedtuple
8 class ArvLoadingContext(LoadingContext):
9 def __init__(self, kwargs=None):
10 self.default_docker_image = None
11 super(ArvLoadingContext, self).__init__(kwargs)
13 class ArvRuntimeContext(RuntimeContext):
14 def __init__(self, kwargs=None):
16 self.extra_reffiles = []
18 self.enable_reuse = True
20 self.submit_request_uuid = None
21 self.project_uuid = None
22 self.trash_intermediate = False
23 self.intermediate_output_ttl = 0
24 self.update_workflow = ""
25 self.create_workflow = False
26 self.submit_runner_ram = 0
27 self.ignore_docker_for_reuse = False
29 self.submit_runner_image = None
31 self.cwl_runner_job = None
32 self.storage_classes = "default"
33 self.intermediate_storage_classes = "default"
34 self.current_container = None
35 self.http_timeout = 300
36 self.submit_runner_cluster = None
37 self.cluster_target_id = 0
38 self.always_submit_runner = False
39 self.collection_cache_size = 256
40 self.match_local_docker = False
41 self.enable_preemptible = None
43 self.defer_downloads = False
44 self.varying_url_params = ""
45 self.prefer_cached_downloads = False
46 self.cached_docker_lookups = {}
47 self.print_keep_deps = False
49 self.enable_usage_report = None
50 self.usage_report_notes = []
52 super(ArvRuntimeContext, self).__init__(kwargs)
54 if self.submit_request_uuid:
55 self.submit_runner_cluster = self.submit_request_uuid[0:5]
57 def get_outdir(self) -> str:
58 """Return self.outdir or create one with self.tmp_outdir_prefix."""
61 def get_tmpdir(self) -> str:
62 """Return self.tmpdir or create one with self.tmpdir_prefix."""
65 def create_tmpdir(self) -> str:
66 """Return self.tmpdir or create one with self.tmpdir_prefix."""