21020: Remove configuration path from Python READMEs
[arvados.git] / sdk / cwl / arvados_cwl / context.py
1 # Copyright (C) The Arvados Authors. All rights reserved.
2 #
3 # SPDX-License-Identifier: Apache-2.0
4
5 from cwltool.context import LoadingContext, RuntimeContext
6 from collections import namedtuple
7
8 class ArvLoadingContext(LoadingContext):
9     def __init__(self, kwargs=None):
10         self.default_docker_image = None
11         super(ArvLoadingContext, self).__init__(kwargs)
12
13 class ArvRuntimeContext(RuntimeContext):
14     def __init__(self, kwargs=None):
15         self.work_api = None
16         self.extra_reffiles = []
17         self.priority = 500
18         self.enable_reuse = True
19         self.runnerjob = ""
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
28         self.submit = True
29         self.submit_runner_image = None
30         self.wait = True
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.copy_deps = 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
48         self.git_info = {}
49         self.enable_usage_report = None
50         self.usage_report_notes = []
51
52         super(ArvRuntimeContext, self).__init__(kwargs)
53
54         if self.submit_request_uuid:
55             self.submit_runner_cluster = self.submit_request_uuid[0:5]
56
57     def get_outdir(self) -> str:
58         """Return self.outdir or create one with self.tmp_outdir_prefix."""
59         return self.outdir
60
61     def get_tmpdir(self) -> str:
62         """Return self.tmpdir or create one with self.tmpdir_prefix."""
63         return self.tmpdir
64
65     def create_tmpdir(self) -> str:
66         """Return self.tmpdir or create one with self.tmpdir_prefix."""
67         return self.tmpdir