toil 9.1.1__py3-none-any.whl → 9.2.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- toil/__init__.py +5 -9
- toil/batchSystems/abstractBatchSystem.py +23 -22
- toil/batchSystems/abstractGridEngineBatchSystem.py +17 -12
- toil/batchSystems/awsBatch.py +8 -8
- toil/batchSystems/cleanup_support.py +4 -4
- toil/batchSystems/contained_executor.py +3 -3
- toil/batchSystems/gridengine.py +3 -4
- toil/batchSystems/htcondor.py +5 -5
- toil/batchSystems/kubernetes.py +65 -63
- toil/batchSystems/local_support.py +2 -3
- toil/batchSystems/lsf.py +6 -7
- toil/batchSystems/mesos/batchSystem.py +11 -7
- toil/batchSystems/mesos/test/__init__.py +1 -2
- toil/batchSystems/options.py +9 -10
- toil/batchSystems/registry.py +3 -7
- toil/batchSystems/singleMachine.py +8 -11
- toil/batchSystems/slurm.py +49 -38
- toil/batchSystems/torque.py +3 -4
- toil/bus.py +36 -34
- toil/common.py +129 -89
- toil/cwl/cwltoil.py +857 -729
- toil/cwl/utils.py +44 -35
- toil/fileStores/__init__.py +3 -1
- toil/fileStores/abstractFileStore.py +28 -30
- toil/fileStores/cachingFileStore.py +8 -8
- toil/fileStores/nonCachingFileStore.py +10 -21
- toil/job.py +159 -158
- toil/jobStores/abstractJobStore.py +68 -69
- toil/jobStores/aws/jobStore.py +249 -213
- toil/jobStores/aws/utils.py +13 -24
- toil/jobStores/fileJobStore.py +28 -22
- toil/jobStores/googleJobStore.py +21 -17
- toil/jobStores/utils.py +3 -7
- toil/leader.py +17 -22
- toil/lib/accelerators.py +6 -4
- toil/lib/aws/__init__.py +9 -10
- toil/lib/aws/ami.py +33 -19
- toil/lib/aws/iam.py +6 -6
- toil/lib/aws/s3.py +259 -157
- toil/lib/aws/session.py +76 -76
- toil/lib/aws/utils.py +51 -43
- toil/lib/checksum.py +19 -15
- toil/lib/compatibility.py +3 -2
- toil/lib/conversions.py +45 -18
- toil/lib/directory.py +29 -26
- toil/lib/docker.py +93 -99
- toil/lib/dockstore.py +77 -50
- toil/lib/ec2.py +39 -38
- toil/lib/ec2nodes.py +11 -4
- toil/lib/exceptions.py +8 -5
- toil/lib/ftp_utils.py +9 -14
- toil/lib/generatedEC2Lists.py +161 -20
- toil/lib/history.py +141 -97
- toil/lib/history_submission.py +163 -72
- toil/lib/io.py +27 -17
- toil/lib/memoize.py +2 -1
- toil/lib/misc.py +15 -11
- toil/lib/pipes.py +40 -25
- toil/lib/plugins.py +12 -8
- toil/lib/resources.py +1 -0
- toil/lib/retry.py +32 -38
- toil/lib/threading.py +12 -12
- toil/lib/throttle.py +1 -2
- toil/lib/trs.py +113 -51
- toil/lib/url.py +14 -23
- toil/lib/web.py +7 -2
- toil/options/common.py +18 -15
- toil/options/cwl.py +2 -2
- toil/options/runner.py +9 -5
- toil/options/wdl.py +1 -3
- toil/provisioners/__init__.py +9 -9
- toil/provisioners/abstractProvisioner.py +22 -20
- toil/provisioners/aws/__init__.py +20 -14
- toil/provisioners/aws/awsProvisioner.py +10 -8
- toil/provisioners/clusterScaler.py +19 -18
- toil/provisioners/gceProvisioner.py +2 -3
- toil/provisioners/node.py +11 -13
- toil/realtimeLogger.py +4 -4
- toil/resource.py +5 -5
- toil/server/app.py +2 -2
- toil/server/cli/wes_cwl_runner.py +11 -11
- toil/server/utils.py +18 -21
- toil/server/wes/abstract_backend.py +9 -8
- toil/server/wes/amazon_wes_utils.py +3 -3
- toil/server/wes/tasks.py +3 -5
- toil/server/wes/toil_backend.py +17 -21
- toil/server/wsgi_app.py +3 -3
- toil/serviceManager.py +3 -4
- toil/statsAndLogging.py +12 -13
- toil/test/__init__.py +33 -24
- toil/test/batchSystems/batchSystemTest.py +12 -11
- toil/test/batchSystems/batch_system_plugin_test.py +3 -5
- toil/test/batchSystems/test_slurm.py +38 -24
- toil/test/cwl/conftest.py +5 -6
- toil/test/cwl/cwlTest.py +194 -78
- toil/test/cwl/download_file_uri.json +6 -0
- toil/test/cwl/download_file_uri_no_hostname.json +6 -0
- toil/test/docs/scripts/tutorial_staging.py +1 -0
- toil/test/jobStores/jobStoreTest.py +9 -7
- toil/test/lib/aws/test_iam.py +1 -3
- toil/test/lib/aws/test_s3.py +1 -1
- toil/test/lib/dockerTest.py +9 -9
- toil/test/lib/test_ec2.py +12 -11
- toil/test/lib/test_history.py +4 -4
- toil/test/lib/test_trs.py +16 -14
- toil/test/lib/test_url.py +7 -6
- toil/test/lib/url_plugin_test.py +12 -18
- toil/test/provisioners/aws/awsProvisionerTest.py +10 -8
- toil/test/provisioners/clusterScalerTest.py +2 -5
- toil/test/provisioners/clusterTest.py +1 -3
- toil/test/server/serverTest.py +13 -4
- toil/test/sort/restart_sort.py +2 -6
- toil/test/sort/sort.py +3 -8
- toil/test/src/deferredFunctionTest.py +7 -7
- toil/test/src/environmentTest.py +1 -2
- toil/test/src/fileStoreTest.py +5 -5
- toil/test/src/importExportFileTest.py +5 -6
- toil/test/src/jobServiceTest.py +22 -14
- toil/test/src/jobTest.py +121 -25
- toil/test/src/miscTests.py +5 -7
- toil/test/src/promisedRequirementTest.py +8 -7
- toil/test/src/regularLogTest.py +2 -3
- toil/test/src/resourceTest.py +5 -8
- toil/test/src/restartDAGTest.py +5 -6
- toil/test/src/resumabilityTest.py +2 -2
- toil/test/src/retainTempDirTest.py +3 -3
- toil/test/src/systemTest.py +3 -3
- toil/test/src/threadingTest.py +1 -1
- toil/test/src/workerTest.py +1 -2
- toil/test/utils/toilDebugTest.py +6 -4
- toil/test/utils/toilKillTest.py +1 -1
- toil/test/utils/utilsTest.py +15 -14
- toil/test/wdl/wdltoil_test.py +247 -124
- toil/test/wdl/wdltoil_test_kubernetes.py +2 -2
- toil/toilState.py +2 -3
- toil/utils/toilDebugFile.py +3 -8
- toil/utils/toilDebugJob.py +1 -2
- toil/utils/toilLaunchCluster.py +1 -2
- toil/utils/toilSshCluster.py +2 -0
- toil/utils/toilStats.py +19 -24
- toil/utils/toilStatus.py +11 -14
- toil/version.py +10 -10
- toil/wdl/wdltoil.py +313 -209
- toil/worker.py +18 -12
- {toil-9.1.1.dist-info → toil-9.2.0.dist-info}/METADATA +11 -14
- {toil-9.1.1.dist-info → toil-9.2.0.dist-info}/RECORD +150 -153
- {toil-9.1.1.dist-info → toil-9.2.0.dist-info}/WHEEL +1 -1
- toil/test/cwl/staging_cat.cwl +0 -27
- toil/test/cwl/staging_make_file.cwl +0 -25
- toil/test/cwl/staging_workflow.cwl +0 -43
- toil/test/cwl/zero_default.cwl +0 -61
- toil/test/utils/ABCWorkflowDebug/ABC.txt +0 -1
- {toil-9.1.1.dist-info → toil-9.2.0.dist-info}/entry_points.txt +0 -0
- {toil-9.1.1.dist-info → toil-9.2.0.dist-info}/licenses/LICENSE +0 -0
- {toil-9.1.1.dist-info → toil-9.2.0.dist-info}/top_level.txt +0 -0
toil/lib/conversions.py
CHANGED
|
@@ -2,28 +2,55 @@
|
|
|
2
2
|
Conversion utilities for mapping memory, disk, core declarations from strings to numbers and vice versa.
|
|
3
3
|
Also contains general conversion functions
|
|
4
4
|
"""
|
|
5
|
+
|
|
5
6
|
import math
|
|
6
7
|
import urllib.parse
|
|
7
|
-
|
|
8
|
-
from typing import Optional, SupportsInt, Union, List
|
|
8
|
+
from typing import SupportsInt
|
|
9
9
|
|
|
10
10
|
KIB = 1024
|
|
11
|
-
MIB = 1024
|
|
12
|
-
GIB = 1024
|
|
13
|
-
TIB = 1024
|
|
14
|
-
PIB = 1024
|
|
15
|
-
EIB = 1024
|
|
11
|
+
MIB = 1024**2
|
|
12
|
+
GIB = 1024**3
|
|
13
|
+
TIB = 1024**4
|
|
14
|
+
PIB = 1024**5
|
|
15
|
+
EIB = 1024**6
|
|
16
16
|
|
|
17
17
|
KB = 1000
|
|
18
|
-
MB = 1000
|
|
19
|
-
GB = 1000
|
|
20
|
-
TB = 1000
|
|
21
|
-
PB = 1000
|
|
22
|
-
EB = 1000
|
|
18
|
+
MB = 1000**2
|
|
19
|
+
GB = 1000**3
|
|
20
|
+
TB = 1000**4
|
|
21
|
+
PB = 1000**5
|
|
22
|
+
EB = 1000**6
|
|
23
23
|
|
|
24
24
|
# See https://en.wikipedia.org/wiki/Binary_prefix
|
|
25
|
-
BINARY_PREFIXES = [
|
|
26
|
-
|
|
25
|
+
BINARY_PREFIXES = [
|
|
26
|
+
"ki",
|
|
27
|
+
"mi",
|
|
28
|
+
"gi",
|
|
29
|
+
"ti",
|
|
30
|
+
"pi",
|
|
31
|
+
"ei",
|
|
32
|
+
"kib",
|
|
33
|
+
"mib",
|
|
34
|
+
"gib",
|
|
35
|
+
"tib",
|
|
36
|
+
"pib",
|
|
37
|
+
"eib",
|
|
38
|
+
]
|
|
39
|
+
DECIMAL_PREFIXES = [
|
|
40
|
+
"b",
|
|
41
|
+
"k",
|
|
42
|
+
"m",
|
|
43
|
+
"g",
|
|
44
|
+
"t",
|
|
45
|
+
"p",
|
|
46
|
+
"e",
|
|
47
|
+
"kb",
|
|
48
|
+
"mb",
|
|
49
|
+
"gb",
|
|
50
|
+
"tb",
|
|
51
|
+
"pb",
|
|
52
|
+
"eb",
|
|
53
|
+
]
|
|
27
54
|
VALID_PREFIXES = BINARY_PREFIXES + DECIMAL_PREFIXES
|
|
28
55
|
|
|
29
56
|
|
|
@@ -113,14 +140,14 @@ def bytes2human(n: SupportsInt) -> str:
|
|
|
113
140
|
return f"{value:.1f} {unit}"
|
|
114
141
|
|
|
115
142
|
|
|
116
|
-
def b_to_mib(n:
|
|
143
|
+
def b_to_mib(n: int | float) -> float:
|
|
117
144
|
"""
|
|
118
145
|
Convert a number from bytes to mibibytes.
|
|
119
146
|
"""
|
|
120
147
|
return convert_units(n, "b", "mib")
|
|
121
148
|
|
|
122
149
|
|
|
123
|
-
def mib_to_b(n:
|
|
150
|
+
def mib_to_b(n: int | float) -> float:
|
|
124
151
|
"""
|
|
125
152
|
Convert a number from mibibytes to bytes.
|
|
126
153
|
"""
|
|
@@ -170,12 +197,12 @@ def strtobool(val: str) -> bool:
|
|
|
170
197
|
raise ValueError(f'Cannot convert "{val}" to a bool')
|
|
171
198
|
|
|
172
199
|
|
|
173
|
-
def opt_strtobool(b:
|
|
200
|
+
def opt_strtobool(b: str | None) -> bool | None:
|
|
174
201
|
"""Convert an optional string representation of bool to None or bool"""
|
|
175
202
|
return b if b is None else strtobool(b)
|
|
176
203
|
|
|
177
204
|
|
|
178
|
-
def modify_url(url: str, remove:
|
|
205
|
+
def modify_url(url: str, remove: list[str]) -> str:
|
|
179
206
|
"""
|
|
180
207
|
Given a valid URL string, split out the params, remove any offending
|
|
181
208
|
params in 'remove', and return the cleaned URL.
|
toil/lib/directory.py
CHANGED
|
@@ -12,13 +12,12 @@
|
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
14
|
|
|
15
|
-
import json
|
|
16
15
|
import base64
|
|
17
|
-
|
|
16
|
+
import json
|
|
17
|
+
from collections.abc import Iterator
|
|
18
|
+
from typing import Union
|
|
18
19
|
from urllib.parse import quote, unquote
|
|
19
20
|
|
|
20
|
-
from typing import Iterator, Optional, Union
|
|
21
|
-
|
|
22
21
|
TOIL_DIR_URI_SCHEME = "toildir:"
|
|
23
22
|
|
|
24
23
|
|
|
@@ -44,7 +43,7 @@ def check_directory_dict_invariants(contents: DirectoryContents) -> None:
|
|
|
44
43
|
|
|
45
44
|
def decode_directory(
|
|
46
45
|
dir_path: str,
|
|
47
|
-
) -> tuple[DirectoryContents,
|
|
46
|
+
) -> tuple[DirectoryContents, str | None, str, str | None, str | None]:
|
|
48
47
|
"""
|
|
49
48
|
Decode a directory from a "toildir:" path to a directory (or a file in it).
|
|
50
49
|
|
|
@@ -69,9 +68,9 @@ def decode_directory(
|
|
|
69
68
|
# Before the first slash is the encoded data describing the directory contents
|
|
70
69
|
encoded_name, encoded_source, dir_data = parts[0].split(":")
|
|
71
70
|
# Decode the name and source, replacing empty string with None again.
|
|
72
|
-
name:
|
|
73
|
-
source:
|
|
74
|
-
|
|
71
|
+
name: str | None = unquote(encoded_name) or None
|
|
72
|
+
source: str | None = unquote(encoded_source) or None
|
|
73
|
+
|
|
75
74
|
# We need the unique key identifying this directory, which is where it came
|
|
76
75
|
# from if stored, or the encoded data itself otherwise.
|
|
77
76
|
# TODO: Is this too complicated?
|
|
@@ -91,7 +90,12 @@ def decode_directory(
|
|
|
91
90
|
# We have a path below this
|
|
92
91
|
return contents, parts[1], directory_identifier, name, source
|
|
93
92
|
|
|
94
|
-
|
|
93
|
+
|
|
94
|
+
def encode_directory(
|
|
95
|
+
contents: DirectoryContents,
|
|
96
|
+
name: str | None = None,
|
|
97
|
+
source: str | None = None,
|
|
98
|
+
) -> str:
|
|
95
99
|
"""
|
|
96
100
|
Encode a directory from a "toildir:" path to a directory (or a file in it).
|
|
97
101
|
|
|
@@ -109,9 +113,7 @@ def encode_directory(contents: DirectoryContents, name: Optional[str] = None, so
|
|
|
109
113
|
TOIL_DIR_URI_SCHEME[:-1],
|
|
110
114
|
quote(name or "", safe=""),
|
|
111
115
|
quote(source or "", safe=""),
|
|
112
|
-
base64.urlsafe_b64encode(
|
|
113
|
-
json.dumps(contents).encode("utf-8")
|
|
114
|
-
).decode("utf-8"),
|
|
116
|
+
base64.urlsafe_b64encode(json.dumps(contents).encode("utf-8")).decode("utf-8"),
|
|
115
117
|
]
|
|
116
118
|
|
|
117
119
|
return ":".join(parts)
|
|
@@ -131,15 +133,18 @@ def directory_item_exists(dir_path: str) -> bool:
|
|
|
131
133
|
return False
|
|
132
134
|
return True
|
|
133
135
|
|
|
134
|
-
|
|
136
|
+
|
|
137
|
+
def get_directory_contents_item(
|
|
138
|
+
contents: DirectoryContents, remaining_path: str | None
|
|
139
|
+
) -> DirectoryContents | str:
|
|
135
140
|
"""
|
|
136
141
|
Get a subdirectory or file from a decoded directory and remaining path.
|
|
137
142
|
"""
|
|
138
143
|
|
|
139
144
|
if remaining_path is None:
|
|
140
145
|
return contents
|
|
141
|
-
|
|
142
|
-
here:
|
|
146
|
+
|
|
147
|
+
here: str | DirectoryContents = contents
|
|
143
148
|
for part in remaining_path.split("/"):
|
|
144
149
|
if not isinstance(here, dict):
|
|
145
150
|
# We're trying to go inside a file
|
|
@@ -151,20 +156,24 @@ def get_directory_contents_item(contents: DirectoryContents, remaining_path: Opt
|
|
|
151
156
|
# If we get here we successfully looked up the thing in the structure
|
|
152
157
|
return here
|
|
153
158
|
|
|
154
|
-
|
|
159
|
+
|
|
160
|
+
def get_directory_item(dir_path: str) -> DirectoryContents | str:
|
|
155
161
|
"""
|
|
156
162
|
Get a subdirectory or file from a URL pointing to or into a toildir: directory.
|
|
157
163
|
"""
|
|
158
164
|
|
|
159
165
|
contents, remaining_path, _, _, _ = decode_directory(dir_path)
|
|
160
|
-
|
|
166
|
+
|
|
161
167
|
try:
|
|
162
168
|
return get_directory_contents_item(contents, remaining_path)
|
|
163
169
|
except FileNotFoundError:
|
|
164
170
|
# Rewrite file not found to be about the full thing we went to look up.
|
|
165
171
|
raise FileNotFoundError(dir_path)
|
|
166
172
|
|
|
167
|
-
|
|
173
|
+
|
|
174
|
+
def directory_contents_items(
|
|
175
|
+
contents: DirectoryContents,
|
|
176
|
+
) -> Iterator[tuple[str, str | None]]:
|
|
168
177
|
"""
|
|
169
178
|
Yield each file or directory under the given contents, including itself.
|
|
170
179
|
|
|
@@ -188,7 +197,8 @@ def directory_contents_items(contents: DirectoryContents) -> Iterator[tuple[str,
|
|
|
188
197
|
for child_path, child_value in directory_contents_items(v):
|
|
189
198
|
yield (f"{k}/{child_path}", child_value)
|
|
190
199
|
|
|
191
|
-
|
|
200
|
+
|
|
201
|
+
def directory_items(dir_path: str) -> Iterator[tuple[str, str | None]]:
|
|
192
202
|
"""
|
|
193
203
|
Yield each file or directory under the given path, including itself.
|
|
194
204
|
|
|
@@ -208,10 +218,3 @@ def directory_items(dir_path: str) -> Iterator[tuple[str, Union[str, None]]]:
|
|
|
208
218
|
else:
|
|
209
219
|
# It's a directory in there.
|
|
210
220
|
yield from directory_contents_items(item)
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
toil/lib/docker.py
CHANGED
|
@@ -11,23 +11,14 @@
|
|
|
11
11
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
12
12
|
# See the License for the specific language governing permissions and
|
|
13
13
|
# limitations under the License.
|
|
14
|
-
from collections.abc import Generator
|
|
15
14
|
import base64
|
|
16
15
|
import logging
|
|
17
16
|
import os
|
|
18
17
|
import re
|
|
19
18
|
import struct
|
|
19
|
+
from collections.abc import Generator
|
|
20
20
|
from shlex import quote
|
|
21
|
-
from typing import
|
|
22
|
-
cast,
|
|
23
|
-
overload,
|
|
24
|
-
Any,
|
|
25
|
-
Literal,
|
|
26
|
-
NoReturn,
|
|
27
|
-
Optional,
|
|
28
|
-
Union,
|
|
29
|
-
TYPE_CHECKING,
|
|
30
|
-
)
|
|
21
|
+
from typing import TYPE_CHECKING, Any, Literal, NoReturn, Union, cast, overload
|
|
31
22
|
|
|
32
23
|
import requests
|
|
33
24
|
|
|
@@ -38,7 +29,10 @@ from docker.errors import ( # type: ignore[import-not-found]
|
|
|
38
29
|
NotFound,
|
|
39
30
|
create_api_error_from_http_exception,
|
|
40
31
|
)
|
|
41
|
-
from docker.utils.socket import
|
|
32
|
+
from docker.utils.socket import ( # type: ignore[import-not-found]
|
|
33
|
+
consume_socket_output,
|
|
34
|
+
demux_adaptor,
|
|
35
|
+
)
|
|
42
36
|
from toil.lib.accelerators import get_host_accelerator_numbers
|
|
43
37
|
|
|
44
38
|
if TYPE_CHECKING:
|
|
@@ -76,24 +70,24 @@ def subprocessDockerCall(*args: Any, **kwargs: Any) -> NoReturn:
|
|
|
76
70
|
def apiDockerCall(
|
|
77
71
|
job: "Job",
|
|
78
72
|
image: str,
|
|
79
|
-
parameters:
|
|
80
|
-
deferParam:
|
|
81
|
-
volumes:
|
|
82
|
-
working_dir:
|
|
83
|
-
containerName:
|
|
84
|
-
entrypoint:
|
|
73
|
+
parameters: list[str] | list[list[str]] | None = None,
|
|
74
|
+
deferParam: int | None = None,
|
|
75
|
+
volumes: dict[str, dict[str, str]] | None = None,
|
|
76
|
+
working_dir: str | None = None,
|
|
77
|
+
containerName: str | None = None,
|
|
78
|
+
entrypoint: str | list[str] | None = None,
|
|
85
79
|
detach: Literal[False] = False,
|
|
86
|
-
log_config:
|
|
87
|
-
auto_remove:
|
|
88
|
-
remove:
|
|
89
|
-
user:
|
|
90
|
-
environment:
|
|
91
|
-
stdout:
|
|
80
|
+
log_config: dict[str, str] | None = None,
|
|
81
|
+
auto_remove: bool | None = None,
|
|
82
|
+
remove: bool | None = False,
|
|
83
|
+
user: str | None = None,
|
|
84
|
+
environment: dict[str, str] | None = None,
|
|
85
|
+
stdout: bool | None = None,
|
|
92
86
|
stderr: bool = False,
|
|
93
87
|
stream: bool = False,
|
|
94
88
|
demux: Literal[False] = False,
|
|
95
|
-
streamfile:
|
|
96
|
-
accelerators:
|
|
89
|
+
streamfile: str | None = None,
|
|
90
|
+
accelerators: list[int] | None = None,
|
|
97
91
|
timeout: int = 365 * 24 * 60 * 60,
|
|
98
92
|
**kwargs: Any,
|
|
99
93
|
) -> str:
|
|
@@ -104,24 +98,24 @@ def apiDockerCall(
|
|
|
104
98
|
def apiDockerCall(
|
|
105
99
|
job: "Job",
|
|
106
100
|
image: str,
|
|
107
|
-
parameters:
|
|
108
|
-
deferParam:
|
|
109
|
-
volumes:
|
|
110
|
-
working_dir:
|
|
111
|
-
containerName:
|
|
112
|
-
entrypoint:
|
|
101
|
+
parameters: list[str] | list[list[str]] | None = None,
|
|
102
|
+
deferParam: int | None = None,
|
|
103
|
+
volumes: dict[str, dict[str, str]] | None = None,
|
|
104
|
+
working_dir: str | None = None,
|
|
105
|
+
containerName: str | None = None,
|
|
106
|
+
entrypoint: str | list[str] | None = None,
|
|
113
107
|
detach: Literal[False] = False,
|
|
114
|
-
log_config:
|
|
115
|
-
auto_remove:
|
|
116
|
-
remove:
|
|
117
|
-
user:
|
|
118
|
-
environment:
|
|
119
|
-
stdout:
|
|
108
|
+
log_config: dict[str, str] | None = None,
|
|
109
|
+
auto_remove: bool | None = None,
|
|
110
|
+
remove: bool | None = False,
|
|
111
|
+
user: str | None = None,
|
|
112
|
+
environment: dict[str, str] | None = None,
|
|
113
|
+
stdout: bool | None = None,
|
|
120
114
|
stderr: bool = False,
|
|
121
115
|
stream: Literal[True] = True,
|
|
122
116
|
demux: Literal[True] = True,
|
|
123
|
-
streamfile:
|
|
124
|
-
accelerators:
|
|
117
|
+
streamfile: str | None = None,
|
|
118
|
+
accelerators: list[int] | None = None,
|
|
125
119
|
timeout: int = 365 * 24 * 60 * 60,
|
|
126
120
|
**kwargs: Any,
|
|
127
121
|
) -> Generator[tuple[str, str]]:
|
|
@@ -132,24 +126,24 @@ def apiDockerCall(
|
|
|
132
126
|
def apiDockerCall(
|
|
133
127
|
job: "Job",
|
|
134
128
|
image: str,
|
|
135
|
-
parameters:
|
|
136
|
-
deferParam:
|
|
137
|
-
volumes:
|
|
138
|
-
working_dir:
|
|
139
|
-
containerName:
|
|
140
|
-
entrypoint:
|
|
129
|
+
parameters: list[str] | list[list[str]] | None = None,
|
|
130
|
+
deferParam: int | None = None,
|
|
131
|
+
volumes: dict[str, dict[str, str]] | None = None,
|
|
132
|
+
working_dir: str | None = None,
|
|
133
|
+
containerName: str | None = None,
|
|
134
|
+
entrypoint: str | list[str] | None = None,
|
|
141
135
|
detach: Literal[False] = False,
|
|
142
|
-
log_config:
|
|
143
|
-
auto_remove:
|
|
144
|
-
remove:
|
|
145
|
-
user:
|
|
146
|
-
environment:
|
|
147
|
-
stdout:
|
|
136
|
+
log_config: dict[str, str] | None = None,
|
|
137
|
+
auto_remove: bool | None = None,
|
|
138
|
+
remove: bool | None = False,
|
|
139
|
+
user: str | None = None,
|
|
140
|
+
environment: dict[str, str] | None = None,
|
|
141
|
+
stdout: bool | None = None,
|
|
148
142
|
stderr: bool = False,
|
|
149
143
|
stream: Literal[False] = False,
|
|
150
144
|
demux: Literal[True] = True,
|
|
151
|
-
streamfile:
|
|
152
|
-
accelerators:
|
|
145
|
+
streamfile: str | None = None,
|
|
146
|
+
accelerators: list[int] | None = None,
|
|
153
147
|
timeout: int = 365 * 24 * 60 * 60,
|
|
154
148
|
**kwargs: Any,
|
|
155
149
|
) -> tuple[str, str]:
|
|
@@ -160,24 +154,24 @@ def apiDockerCall(
|
|
|
160
154
|
def apiDockerCall(
|
|
161
155
|
job: "Job",
|
|
162
156
|
image: str,
|
|
163
|
-
parameters:
|
|
164
|
-
deferParam:
|
|
165
|
-
volumes:
|
|
166
|
-
working_dir:
|
|
167
|
-
containerName:
|
|
168
|
-
entrypoint:
|
|
157
|
+
parameters: list[str] | list[list[str]] | None = None,
|
|
158
|
+
deferParam: int | None = None,
|
|
159
|
+
volumes: dict[str, dict[str, str]] | None = None,
|
|
160
|
+
working_dir: str | None = None,
|
|
161
|
+
containerName: str | None = None,
|
|
162
|
+
entrypoint: str | list[str] | None = None,
|
|
169
163
|
detach: Literal[True] = True,
|
|
170
|
-
log_config:
|
|
171
|
-
auto_remove:
|
|
172
|
-
remove:
|
|
173
|
-
user:
|
|
174
|
-
environment:
|
|
175
|
-
stdout:
|
|
164
|
+
log_config: dict[str, str] | None = None,
|
|
165
|
+
auto_remove: bool | None = None,
|
|
166
|
+
remove: bool | None = False,
|
|
167
|
+
user: str | None = None,
|
|
168
|
+
environment: dict[str, str] | None = None,
|
|
169
|
+
stdout: bool | None = None,
|
|
176
170
|
stderr: bool = False,
|
|
177
171
|
stream: bool = False,
|
|
178
172
|
demux: bool = False,
|
|
179
|
-
streamfile:
|
|
180
|
-
accelerators:
|
|
173
|
+
streamfile: str | None = None,
|
|
174
|
+
accelerators: list[int] | None = None,
|
|
181
175
|
timeout: int = 365 * 24 * 60 * 60,
|
|
182
176
|
**kwargs: Any,
|
|
183
177
|
) -> "Container":
|
|
@@ -188,24 +182,24 @@ def apiDockerCall(
|
|
|
188
182
|
def apiDockerCall(
|
|
189
183
|
job: "Job",
|
|
190
184
|
image: str,
|
|
191
|
-
parameters:
|
|
192
|
-
deferParam:
|
|
193
|
-
volumes:
|
|
194
|
-
working_dir:
|
|
195
|
-
containerName:
|
|
196
|
-
entrypoint:
|
|
185
|
+
parameters: list[str] | list[list[str]] | None = None,
|
|
186
|
+
deferParam: int | None = None,
|
|
187
|
+
volumes: dict[str, dict[str, str]] | None = None,
|
|
188
|
+
working_dir: str | None = None,
|
|
189
|
+
containerName: str | None = None,
|
|
190
|
+
entrypoint: str | list[str] | None = None,
|
|
197
191
|
detach: bool = False,
|
|
198
|
-
log_config:
|
|
199
|
-
auto_remove:
|
|
200
|
-
remove:
|
|
201
|
-
user:
|
|
202
|
-
environment:
|
|
203
|
-
stdout:
|
|
192
|
+
log_config: dict[str, str] | None = None,
|
|
193
|
+
auto_remove: bool | None = None,
|
|
194
|
+
remove: bool | None = False,
|
|
195
|
+
user: str | None = None,
|
|
196
|
+
environment: dict[str, str] | None = None,
|
|
197
|
+
stdout: bool | None = None,
|
|
204
198
|
stderr: bool = False,
|
|
205
199
|
stream: bool = False,
|
|
206
200
|
demux: bool = False,
|
|
207
|
-
streamfile:
|
|
208
|
-
accelerators:
|
|
201
|
+
streamfile: str | None = None,
|
|
202
|
+
accelerators: list[int] | None = None,
|
|
209
203
|
timeout: int = 365 * 24 * 60 * 60,
|
|
210
204
|
**kwargs: Any,
|
|
211
205
|
) -> Union[
|
|
@@ -216,24 +210,24 @@ def apiDockerCall(
|
|
|
216
210
|
def apiDockerCall(
|
|
217
211
|
job: "Job",
|
|
218
212
|
image: str,
|
|
219
|
-
parameters:
|
|
220
|
-
deferParam:
|
|
221
|
-
volumes:
|
|
222
|
-
working_dir:
|
|
223
|
-
containerName:
|
|
224
|
-
entrypoint:
|
|
213
|
+
parameters: list[str] | list[list[str]] | None = None,
|
|
214
|
+
deferParam: int | None = None,
|
|
215
|
+
volumes: dict[str, dict[str, str]] | None = None,
|
|
216
|
+
working_dir: str | None = None,
|
|
217
|
+
containerName: str | None = None,
|
|
218
|
+
entrypoint: str | list[str] | None = None,
|
|
225
219
|
detach: bool = False,
|
|
226
|
-
log_config:
|
|
227
|
-
auto_remove:
|
|
228
|
-
remove:
|
|
229
|
-
user:
|
|
230
|
-
environment:
|
|
231
|
-
stdout:
|
|
220
|
+
log_config: dict[str, str] | None = None,
|
|
221
|
+
auto_remove: bool | None = None,
|
|
222
|
+
remove: bool | None = False,
|
|
223
|
+
user: str | None = None,
|
|
224
|
+
environment: dict[str, str] | None = None,
|
|
225
|
+
stdout: bool | None = None,
|
|
232
226
|
stderr: bool = False,
|
|
233
227
|
stream: bool = False,
|
|
234
228
|
demux: bool = False,
|
|
235
|
-
streamfile:
|
|
236
|
-
accelerators:
|
|
229
|
+
streamfile: str | None = None,
|
|
230
|
+
accelerators: list[int] | None = None,
|
|
237
231
|
timeout: int = 365 * 24 * 60 * 60,
|
|
238
232
|
**kwargs: Any,
|
|
239
233
|
) -> Union[
|
|
@@ -369,7 +363,7 @@ def apiDockerCall(
|
|
|
369
363
|
" ".join(quote(arg) for arg in command) for command in parameters
|
|
370
364
|
]
|
|
371
365
|
pipe_prefix = "set -eo pipefail && "
|
|
372
|
-
command:
|
|
366
|
+
command: None | str | list[str] = [pipe_prefix + " | ".join(chain_params)]
|
|
373
367
|
logger.debug("Calling docker with: " + repr(command))
|
|
374
368
|
|
|
375
369
|
# If 'parameters' is a normal list, join all elements into a single string
|
|
@@ -592,7 +586,7 @@ def dockerStop(container_name: str, remove: bool = False) -> None:
|
|
|
592
586
|
|
|
593
587
|
def containerIsRunning(
|
|
594
588
|
container_name: str, timeout: int = 365 * 24 * 60 * 60
|
|
595
|
-
) ->
|
|
589
|
+
) -> bool | None:
|
|
596
590
|
"""
|
|
597
591
|
Checks whether the container is running or not.
|
|
598
592
|
|
|
@@ -635,7 +629,7 @@ def getContainerName(job: "Job") -> str:
|
|
|
635
629
|
|
|
636
630
|
def _multiplexed_response_stream_helper(
|
|
637
631
|
response: requests.Response,
|
|
638
|
-
) -> Generator[tuple[Any,
|
|
632
|
+
) -> Generator[tuple[Any, bytes | Any]]:
|
|
639
633
|
"""
|
|
640
634
|
A generator of multiplexed data blocks coming from a response stream modified from:
|
|
641
635
|
https://github.com/docker/docker-py/blob/4.3.1-release/docker/api/client.py#L370
|