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
42 self.enable_resubmit_non_preemptible = None
44 self.defer_downloads = False
45 self.varying_url_params = ""
46 self.prefer_cached_downloads = False
47 self.cached_docker_lookups = {}
48 self.print_keep_deps = False
50 self.enable_usage_report = None
51 self.usage_report_notes = []
53 super(ArvRuntimeContext, self).__init__(kwargs)
55 if self.submit_request_uuid:
56 self.submit_runner_cluster = self.submit_request_uuid[0:5]
58 def get_outdir(self) -> str:
59 """Return self.outdir or create one with self.tmp_outdir_prefix."""
62 def get_tmpdir(self) -> str:
63 """Return self.tmpdir or create one with self.tmpdir_prefix."""
66 def create_tmpdir(self) -> str:
67 """Return self.tmpdir or create one with self.tmpdir_prefix."""