toil 7.0.0__py3-none-any.whl → 8.0.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 +121 -83
- toil/batchSystems/__init__.py +1 -0
- toil/batchSystems/abstractBatchSystem.py +137 -77
- toil/batchSystems/abstractGridEngineBatchSystem.py +211 -101
- toil/batchSystems/awsBatch.py +237 -128
- toil/batchSystems/cleanup_support.py +22 -16
- toil/batchSystems/contained_executor.py +30 -26
- toil/batchSystems/gridengine.py +85 -49
- toil/batchSystems/htcondor.py +164 -87
- toil/batchSystems/kubernetes.py +622 -386
- toil/batchSystems/local_support.py +17 -12
- toil/batchSystems/lsf.py +132 -79
- toil/batchSystems/lsfHelper.py +13 -11
- toil/batchSystems/mesos/__init__.py +41 -29
- toil/batchSystems/mesos/batchSystem.py +288 -149
- toil/batchSystems/mesos/executor.py +77 -49
- toil/batchSystems/mesos/test/__init__.py +31 -23
- toil/batchSystems/options.py +38 -29
- toil/batchSystems/registry.py +53 -19
- toil/batchSystems/singleMachine.py +293 -123
- toil/batchSystems/slurm.py +489 -137
- toil/batchSystems/torque.py +46 -32
- toil/bus.py +141 -73
- toil/common.py +630 -359
- toil/cwl/__init__.py +1 -1
- toil/cwl/cwltoil.py +1114 -532
- toil/cwl/utils.py +17 -22
- toil/deferred.py +62 -41
- toil/exceptions.py +5 -3
- toil/fileStores/__init__.py +5 -5
- toil/fileStores/abstractFileStore.py +88 -57
- toil/fileStores/cachingFileStore.py +711 -247
- toil/fileStores/nonCachingFileStore.py +113 -75
- toil/job.py +988 -315
- toil/jobStores/abstractJobStore.py +387 -243
- toil/jobStores/aws/jobStore.py +727 -403
- toil/jobStores/aws/utils.py +161 -109
- toil/jobStores/conftest.py +1 -0
- toil/jobStores/fileJobStore.py +289 -151
- toil/jobStores/googleJobStore.py +137 -70
- toil/jobStores/utils.py +36 -15
- toil/leader.py +614 -269
- toil/lib/accelerators.py +115 -18
- toil/lib/aws/__init__.py +55 -28
- toil/lib/aws/ami.py +122 -87
- toil/lib/aws/iam.py +284 -108
- toil/lib/aws/s3.py +31 -0
- toil/lib/aws/session.py +193 -58
- toil/lib/aws/utils.py +238 -218
- toil/lib/bioio.py +13 -5
- toil/lib/compatibility.py +11 -6
- toil/lib/conversions.py +83 -49
- toil/lib/docker.py +131 -103
- toil/lib/ec2.py +322 -209
- toil/lib/ec2nodes.py +174 -106
- toil/lib/encryption/_dummy.py +5 -3
- toil/lib/encryption/_nacl.py +10 -6
- toil/lib/encryption/conftest.py +1 -0
- toil/lib/exceptions.py +26 -7
- toil/lib/expando.py +4 -2
- toil/lib/ftp_utils.py +217 -0
- toil/lib/generatedEC2Lists.py +127 -19
- toil/lib/humanize.py +6 -2
- toil/lib/integration.py +341 -0
- toil/lib/io.py +99 -11
- toil/lib/iterables.py +4 -2
- toil/lib/memoize.py +12 -8
- toil/lib/misc.py +65 -18
- toil/lib/objects.py +2 -2
- toil/lib/resources.py +19 -7
- toil/lib/retry.py +115 -77
- toil/lib/threading.py +282 -80
- toil/lib/throttle.py +15 -14
- toil/options/common.py +834 -401
- toil/options/cwl.py +175 -90
- toil/options/runner.py +50 -0
- toil/options/wdl.py +70 -19
- toil/provisioners/__init__.py +111 -46
- toil/provisioners/abstractProvisioner.py +322 -157
- toil/provisioners/aws/__init__.py +62 -30
- toil/provisioners/aws/awsProvisioner.py +980 -627
- toil/provisioners/clusterScaler.py +541 -279
- toil/provisioners/gceProvisioner.py +282 -179
- toil/provisioners/node.py +147 -79
- toil/realtimeLogger.py +34 -22
- toil/resource.py +137 -75
- toil/server/app.py +127 -61
- toil/server/celery_app.py +3 -1
- toil/server/cli/wes_cwl_runner.py +82 -53
- toil/server/utils.py +54 -28
- toil/server/wes/abstract_backend.py +64 -26
- toil/server/wes/amazon_wes_utils.py +21 -15
- toil/server/wes/tasks.py +121 -63
- toil/server/wes/toil_backend.py +142 -107
- toil/server/wsgi_app.py +4 -3
- toil/serviceManager.py +58 -22
- toil/statsAndLogging.py +148 -64
- toil/test/__init__.py +263 -179
- toil/test/batchSystems/batchSystemTest.py +438 -195
- toil/test/batchSystems/batch_system_plugin_test.py +18 -7
- toil/test/batchSystems/test_gridengine.py +173 -0
- toil/test/batchSystems/test_lsf_helper.py +67 -58
- toil/test/batchSystems/test_slurm.py +93 -47
- toil/test/cactus/test_cactus_integration.py +20 -22
- toil/test/cwl/cwlTest.py +271 -71
- toil/test/cwl/measure_default_memory.cwl +12 -0
- toil/test/cwl/not_run_required_input.cwl +29 -0
- toil/test/cwl/scatter_duplicate_outputs.cwl +40 -0
- toil/test/docs/scriptsTest.py +60 -34
- toil/test/jobStores/jobStoreTest.py +412 -235
- toil/test/lib/aws/test_iam.py +116 -48
- toil/test/lib/aws/test_s3.py +16 -9
- toil/test/lib/aws/test_utils.py +5 -6
- toil/test/lib/dockerTest.py +118 -141
- toil/test/lib/test_conversions.py +113 -115
- toil/test/lib/test_ec2.py +57 -49
- toil/test/lib/test_integration.py +104 -0
- toil/test/lib/test_misc.py +12 -5
- toil/test/mesos/MesosDataStructuresTest.py +23 -10
- toil/test/mesos/helloWorld.py +7 -6
- toil/test/mesos/stress.py +25 -20
- toil/test/options/options.py +7 -2
- toil/test/provisioners/aws/awsProvisionerTest.py +293 -140
- toil/test/provisioners/clusterScalerTest.py +440 -250
- toil/test/provisioners/clusterTest.py +81 -42
- toil/test/provisioners/gceProvisionerTest.py +174 -100
- toil/test/provisioners/provisionerTest.py +25 -13
- toil/test/provisioners/restartScript.py +5 -4
- toil/test/server/serverTest.py +188 -141
- toil/test/sort/restart_sort.py +137 -68
- toil/test/sort/sort.py +134 -66
- toil/test/sort/sortTest.py +91 -49
- toil/test/src/autoDeploymentTest.py +140 -100
- toil/test/src/busTest.py +20 -18
- toil/test/src/checkpointTest.py +8 -2
- toil/test/src/deferredFunctionTest.py +49 -35
- toil/test/src/dockerCheckTest.py +33 -26
- toil/test/src/environmentTest.py +20 -10
- toil/test/src/fileStoreTest.py +538 -271
- toil/test/src/helloWorldTest.py +7 -4
- toil/test/src/importExportFileTest.py +61 -31
- toil/test/src/jobDescriptionTest.py +32 -17
- toil/test/src/jobEncapsulationTest.py +2 -0
- toil/test/src/jobFileStoreTest.py +74 -50
- toil/test/src/jobServiceTest.py +187 -73
- toil/test/src/jobTest.py +120 -70
- toil/test/src/miscTests.py +19 -18
- toil/test/src/promisedRequirementTest.py +82 -36
- toil/test/src/promisesTest.py +7 -6
- toil/test/src/realtimeLoggerTest.py +6 -6
- toil/test/src/regularLogTest.py +71 -37
- toil/test/src/resourceTest.py +80 -49
- toil/test/src/restartDAGTest.py +36 -22
- toil/test/src/resumabilityTest.py +9 -2
- toil/test/src/retainTempDirTest.py +45 -14
- toil/test/src/systemTest.py +12 -8
- toil/test/src/threadingTest.py +44 -25
- toil/test/src/toilContextManagerTest.py +10 -7
- toil/test/src/userDefinedJobArgTypeTest.py +8 -5
- toil/test/src/workerTest.py +33 -16
- toil/test/utils/toilDebugTest.py +70 -58
- toil/test/utils/toilKillTest.py +4 -5
- toil/test/utils/utilsTest.py +239 -102
- toil/test/wdl/wdltoil_test.py +789 -148
- toil/test/wdl/wdltoil_test_kubernetes.py +37 -23
- toil/toilState.py +52 -26
- toil/utils/toilConfig.py +13 -4
- toil/utils/toilDebugFile.py +44 -27
- toil/utils/toilDebugJob.py +85 -25
- toil/utils/toilDestroyCluster.py +11 -6
- toil/utils/toilKill.py +8 -3
- toil/utils/toilLaunchCluster.py +251 -145
- toil/utils/toilMain.py +37 -16
- toil/utils/toilRsyncCluster.py +27 -14
- toil/utils/toilSshCluster.py +45 -22
- toil/utils/toilStats.py +75 -36
- toil/utils/toilStatus.py +226 -119
- toil/utils/toilUpdateEC2Instances.py +3 -1
- toil/version.py +11 -11
- toil/wdl/utils.py +5 -5
- toil/wdl/wdltoil.py +3513 -1052
- toil/worker.py +269 -128
- toil-8.0.0.dist-info/METADATA +173 -0
- toil-8.0.0.dist-info/RECORD +253 -0
- {toil-7.0.0.dist-info → toil-8.0.0.dist-info}/WHEEL +1 -1
- toil-7.0.0.dist-info/METADATA +0 -158
- toil-7.0.0.dist-info/RECORD +0 -244
- {toil-7.0.0.dist-info → toil-8.0.0.dist-info}/LICENSE +0 -0
- {toil-7.0.0.dist-info → toil-8.0.0.dist-info}/entry_points.txt +0 -0
- {toil-7.0.0.dist-info → toil-8.0.0.dist-info}/top_level.txt +0 -0
|
@@ -4,7 +4,10 @@ from queue import Queue
|
|
|
4
4
|
import pytest
|
|
5
5
|
|
|
6
6
|
import toil.batchSystems.slurm
|
|
7
|
-
from toil.batchSystems.abstractBatchSystem import
|
|
7
|
+
from toil.batchSystems.abstractBatchSystem import (
|
|
8
|
+
EXIT_STATUS_UNAVAILABLE_VALUE,
|
|
9
|
+
BatchJobExitReason,
|
|
10
|
+
)
|
|
8
11
|
from toil.common import Config
|
|
9
12
|
from toil.lib.misc import CalledProcessErrorStderr
|
|
10
13
|
from toil.test import ToilTest
|
|
@@ -12,6 +15,7 @@ from toil.test import ToilTest
|
|
|
12
15
|
# TODO: Come up with a better way to mock the commands then monkey-patching the
|
|
13
16
|
# command-calling functions.
|
|
14
17
|
|
|
18
|
+
|
|
15
19
|
def call_sacct(args, **_) -> str:
|
|
16
20
|
"""
|
|
17
21
|
The arguments passed to `call_command` when executing `sacct` are:
|
|
@@ -37,7 +41,7 @@ def call_sacct(args, **_) -> str:
|
|
|
37
41
|
789868: "789868|PENDING|0:0\n",
|
|
38
42
|
789869: "789869|COMPLETED|0:0\n789869.batch|COMPLETED|0:0\n789869.extern|COMPLETED|0:0\n",
|
|
39
43
|
}
|
|
40
|
-
job_ids = [int(job_id) for job_id in args[3].split(
|
|
44
|
+
job_ids = [int(job_id) for job_id in args[3].split(",")]
|
|
41
45
|
stdout = ""
|
|
42
46
|
# Glue the fake outputs for the request job-ids together in a single string
|
|
43
47
|
for job_id in job_ids:
|
|
@@ -53,7 +57,8 @@ def call_scontrol(args, **_) -> str:
|
|
|
53
57
|
job_id = int(args[3]) if len(args) > 3 else None
|
|
54
58
|
# Fake output per fake job-id.
|
|
55
59
|
scontrol_info = {
|
|
56
|
-
787204: textwrap.dedent(
|
|
60
|
+
787204: textwrap.dedent(
|
|
61
|
+
"""\
|
|
57
62
|
JobId=787204 JobName=toil_job_6_CWLJob
|
|
58
63
|
UserId=rapthor-mloose(54386) GroupId=rapthor-mloose(54038) MCS_label=N/A
|
|
59
64
|
Priority=11067 Nice=0 Account=rapthor QOS=normal
|
|
@@ -81,8 +86,10 @@ def call_scontrol(args, **_) -> str:
|
|
|
81
86
|
StdOut=/home/rapthor-mloose/code/toil/cwl-v1.2/tmp/toil_19512746-a9f4-4b99-b9ff-48ca5c1b661c.6.787204.out.log
|
|
82
87
|
Power=
|
|
83
88
|
NtasksPerTRES:0
|
|
84
|
-
"""
|
|
85
|
-
|
|
89
|
+
"""
|
|
90
|
+
),
|
|
91
|
+
789724: textwrap.dedent(
|
|
92
|
+
"""\
|
|
86
93
|
JobId=789724 JobName=run_prefactor-cwltool.sh
|
|
87
94
|
UserId=rapthor-mloose(54386) GroupId=rapthor-mloose(54038) MCS_label=N/A
|
|
88
95
|
Priority=7905 Nice=0 Account=rapthor QOS=normal
|
|
@@ -110,8 +117,10 @@ def call_scontrol(args, **_) -> str:
|
|
|
110
117
|
StdOut=/project/rapthor/Share/prefactor/L721962/slurm-789724.out
|
|
111
118
|
Power=
|
|
112
119
|
NtasksPerTRES:0
|
|
113
|
-
"""
|
|
114
|
-
|
|
120
|
+
"""
|
|
121
|
+
),
|
|
122
|
+
789728: textwrap.dedent(
|
|
123
|
+
"""\
|
|
115
124
|
JobId=789728 JobName=sleep.sh
|
|
116
125
|
UserId=rapthor-mloose(54386) GroupId=rapthor-mloose(54038) MCS_label=N/A
|
|
117
126
|
Priority=8005 Nice=0 Account=rapthor QOS=normal
|
|
@@ -138,26 +147,31 @@ def call_scontrol(args, **_) -> str:
|
|
|
138
147
|
StdOut=/home/rapthor-mloose/tmp/slurm-789728.out
|
|
139
148
|
Power=
|
|
140
149
|
NtasksPerTRES:0
|
|
141
|
-
"""
|
|
150
|
+
"""
|
|
151
|
+
),
|
|
142
152
|
}
|
|
143
153
|
if job_id is not None:
|
|
144
154
|
try:
|
|
145
155
|
stdout = scontrol_info[job_id]
|
|
146
156
|
except KeyError:
|
|
147
|
-
raise CalledProcessErrorStderr(
|
|
157
|
+
raise CalledProcessErrorStderr(
|
|
158
|
+
1, "slurm_load_jobs error: Invalid job id specified"
|
|
159
|
+
)
|
|
148
160
|
else:
|
|
149
161
|
# Glue the fake outputs for the request job-ids together in a single string
|
|
150
162
|
stdout = ""
|
|
151
163
|
for value in scontrol_info.values():
|
|
152
|
-
stdout += value +
|
|
164
|
+
stdout += value + "\n"
|
|
153
165
|
return stdout
|
|
154
166
|
|
|
167
|
+
|
|
155
168
|
def call_sacct_raises(*_):
|
|
156
169
|
"""
|
|
157
170
|
Fake that the `sacct` command fails by raising a `CalledProcessErrorStderr`
|
|
158
171
|
"""
|
|
159
|
-
raise CalledProcessErrorStderr(
|
|
160
|
-
|
|
172
|
+
raise CalledProcessErrorStderr(
|
|
173
|
+
1, "sacct: error: Problem talking to the database: " "Connection timed out"
|
|
174
|
+
)
|
|
161
175
|
|
|
162
176
|
|
|
163
177
|
class FakeBatchSystem:
|
|
@@ -169,7 +183,7 @@ class FakeBatchSystem:
|
|
|
169
183
|
self.config = self.__fake_config()
|
|
170
184
|
|
|
171
185
|
def getWaitDuration(self):
|
|
172
|
-
return 10
|
|
186
|
+
return 10
|
|
173
187
|
|
|
174
188
|
def __fake_config(self):
|
|
175
189
|
"""
|
|
@@ -181,8 +195,9 @@ class FakeBatchSystem:
|
|
|
181
195
|
"""
|
|
182
196
|
config = Config()
|
|
183
197
|
from uuid import uuid4
|
|
198
|
+
|
|
184
199
|
config.workflowID = str(uuid4())
|
|
185
|
-
config.cleanWorkDir =
|
|
200
|
+
config.cleanWorkDir = "always"
|
|
186
201
|
return config
|
|
187
202
|
|
|
188
203
|
|
|
@@ -198,7 +213,8 @@ class SlurmTest(ToilTest):
|
|
|
198
213
|
updatedJobsQueue=Queue(),
|
|
199
214
|
killQueue=Queue(),
|
|
200
215
|
killedJobsQueue=Queue(),
|
|
201
|
-
boss=FakeBatchSystem()
|
|
216
|
+
boss=FakeBatchSystem(),
|
|
217
|
+
)
|
|
202
218
|
|
|
203
219
|
####
|
|
204
220
|
#### tests for _getJobDetailsFromSacct()
|
|
@@ -218,15 +234,25 @@ class SlurmTest(ToilTest):
|
|
|
218
234
|
|
|
219
235
|
def test_getJobDetailsFromSacct_many_all_exist(self):
|
|
220
236
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
|
|
221
|
-
expected_result = {
|
|
222
|
-
|
|
237
|
+
expected_result = {
|
|
238
|
+
754725: ("TIMEOUT", 0),
|
|
239
|
+
789456: ("FAILED", 1),
|
|
240
|
+
789724: ("RUNNING", 0),
|
|
241
|
+
789868: ("PENDING", 0),
|
|
242
|
+
789869: ("COMPLETED", 0),
|
|
243
|
+
}
|
|
223
244
|
result = self.worker._getJobDetailsFromSacct(list(expected_result))
|
|
224
245
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
225
246
|
|
|
226
247
|
def test_getJobDetailsFromSacct_many_some_exist(self):
|
|
227
248
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
|
|
228
|
-
expected_result = {
|
|
229
|
-
|
|
249
|
+
expected_result = {
|
|
250
|
+
609663: ("FAILED", 130),
|
|
251
|
+
767925: ("FAILED", 2),
|
|
252
|
+
1234: (None, None),
|
|
253
|
+
1235: (None, None),
|
|
254
|
+
765096: ("FAILED", 137),
|
|
255
|
+
}
|
|
230
256
|
result = self.worker._getJobDetailsFromSacct(list(expected_result))
|
|
231
257
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
232
258
|
|
|
@@ -262,13 +288,21 @@ class SlurmTest(ToilTest):
|
|
|
262
288
|
|
|
263
289
|
def test_getJobDetailsFromScontrol_many_all_exist(self):
|
|
264
290
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_scontrol)
|
|
265
|
-
expected_result = {
|
|
291
|
+
expected_result = {
|
|
292
|
+
787204: ("COMPLETED", 0),
|
|
293
|
+
789724: ("RUNNING", 0),
|
|
294
|
+
789728: ("PENDING", 0),
|
|
295
|
+
}
|
|
266
296
|
result = self.worker._getJobDetailsFromScontrol(list(expected_result))
|
|
267
297
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
268
298
|
|
|
269
299
|
def test_getJobDetailsFromScontrol_many_some_exist(self):
|
|
270
300
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_scontrol)
|
|
271
|
-
expected_result = {
|
|
301
|
+
expected_result = {
|
|
302
|
+
787204: ("COMPLETED", 0),
|
|
303
|
+
789724: ("RUNNING", 0),
|
|
304
|
+
1234: (None, None),
|
|
305
|
+
}
|
|
272
306
|
result = self.worker._getJobDetailsFromScontrol(list(expected_result))
|
|
273
307
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
274
308
|
|
|
@@ -284,14 +318,14 @@ class SlurmTest(ToilTest):
|
|
|
284
318
|
|
|
285
319
|
def test_getJobExitCode_job_exists(self):
|
|
286
320
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
|
|
287
|
-
job_id =
|
|
321
|
+
job_id = "785023" # FAILED
|
|
288
322
|
expected_result = (127, BatchJobExitReason.FAILED)
|
|
289
323
|
result = self.worker.getJobExitCode(job_id)
|
|
290
324
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
291
325
|
|
|
292
326
|
def test_getJobExitCode_job_not_exists(self):
|
|
293
327
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
|
|
294
|
-
job_id =
|
|
328
|
+
job_id = "1234" # Non-existent
|
|
295
329
|
expected_result = None
|
|
296
330
|
result = self.worker.getJobExitCode(job_id)
|
|
297
331
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
@@ -301,10 +335,12 @@ class SlurmTest(ToilTest):
|
|
|
301
335
|
This test forces the use of `scontrol` to get job information, by letting `sacct`
|
|
302
336
|
raise an exception.
|
|
303
337
|
"""
|
|
304
|
-
self.monkeypatch.setattr(
|
|
338
|
+
self.monkeypatch.setattr(
|
|
339
|
+
self.worker, "_getJobDetailsFromSacct", call_sacct_raises
|
|
340
|
+
)
|
|
305
341
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_scontrol)
|
|
306
|
-
job_id =
|
|
307
|
-
expected_result = (0,
|
|
342
|
+
job_id = "787204" # COMPLETED
|
|
343
|
+
expected_result = (0, BatchJobExitReason.FINISHED)
|
|
308
344
|
result = self.worker.getJobExitCode(job_id)
|
|
309
345
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
310
346
|
|
|
@@ -313,9 +349,11 @@ class SlurmTest(ToilTest):
|
|
|
313
349
|
This test forces the use of `scontrol` to get job information, by letting `sacct`
|
|
314
350
|
raise an exception. Next, `scontrol` should also raise because it doesn't know the job.
|
|
315
351
|
"""
|
|
316
|
-
self.monkeypatch.setattr(
|
|
352
|
+
self.monkeypatch.setattr(
|
|
353
|
+
self.worker, "_getJobDetailsFromSacct", call_sacct_raises
|
|
354
|
+
)
|
|
317
355
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_scontrol)
|
|
318
|
-
job_id =
|
|
356
|
+
job_id = "1234" # Non-existent
|
|
319
357
|
try:
|
|
320
358
|
_ = self.worker.getJobExitCode(job_id)
|
|
321
359
|
except CalledProcessErrorStderr:
|
|
@@ -329,50 +367,54 @@ class SlurmTest(ToilTest):
|
|
|
329
367
|
|
|
330
368
|
def test_coalesce_job_exit_codes_one_exists(self):
|
|
331
369
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
|
|
332
|
-
job_ids = [
|
|
333
|
-
expected_result = [(127,
|
|
370
|
+
job_ids = ["785023"] # FAILED
|
|
371
|
+
expected_result = [(127, BatchJobExitReason.FAILED)]
|
|
334
372
|
result = self.worker.coalesce_job_exit_codes(job_ids)
|
|
335
373
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
336
374
|
|
|
337
375
|
def test_coalesce_job_exit_codes_one_not_exists(self):
|
|
338
376
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
|
|
339
|
-
job_ids = [
|
|
377
|
+
job_ids = ["1234"] # Non-existent
|
|
340
378
|
expected_result = [None]
|
|
341
379
|
result = self.worker.coalesce_job_exit_codes(job_ids)
|
|
342
380
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
343
381
|
|
|
344
382
|
def test_coalesce_job_exit_codes_many_all_exist(self):
|
|
345
383
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
|
|
346
|
-
job_ids = [
|
|
347
|
-
|
|
348
|
-
|
|
349
|
-
|
|
350
|
-
|
|
384
|
+
job_ids = [
|
|
385
|
+
"754725", # TIMEOUT,
|
|
386
|
+
"789456", # FAILED,
|
|
387
|
+
"789724", # RUNNING,
|
|
388
|
+
"789868", # PENDING,
|
|
389
|
+
"789869",
|
|
390
|
+
] # COMPLETED
|
|
351
391
|
# RUNNING and PENDING jobs should return None
|
|
352
392
|
expected_result = [
|
|
353
393
|
(EXIT_STATUS_UNAVAILABLE_VALUE, BatchJobExitReason.KILLED),
|
|
354
394
|
(1, BatchJobExitReason.FAILED),
|
|
355
395
|
None,
|
|
356
396
|
None,
|
|
357
|
-
(0, BatchJobExitReason.FINISHED)
|
|
397
|
+
(0, BatchJobExitReason.FINISHED),
|
|
358
398
|
]
|
|
359
399
|
result = self.worker.coalesce_job_exit_codes(job_ids)
|
|
360
400
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
361
401
|
|
|
362
402
|
def test_coalesce_job_exit_codes_some_exists(self):
|
|
363
403
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
|
|
364
|
-
job_ids = [
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
404
|
+
job_ids = [
|
|
405
|
+
"609663", # FAILED (SIGINT)
|
|
406
|
+
"767925", # FAILED,
|
|
407
|
+
"789724", # RUNNING,
|
|
408
|
+
"999999", # Non-existent,
|
|
409
|
+
"789869",
|
|
410
|
+
] # COMPLETED
|
|
369
411
|
# RUNNING job should return None
|
|
370
412
|
expected_result = [
|
|
371
413
|
(130, BatchJobExitReason.FAILED),
|
|
372
414
|
(2, BatchJobExitReason.FAILED),
|
|
373
415
|
None,
|
|
374
416
|
None,
|
|
375
|
-
(0, BatchJobExitReason.FINISHED)
|
|
417
|
+
(0, BatchJobExitReason.FINISHED),
|
|
376
418
|
]
|
|
377
419
|
result = self.worker.coalesce_job_exit_codes(job_ids)
|
|
378
420
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
@@ -382,9 +424,11 @@ class SlurmTest(ToilTest):
|
|
|
382
424
|
This test forces the use of `scontrol` to get job information, by letting `sacct`
|
|
383
425
|
raise an exception.
|
|
384
426
|
"""
|
|
385
|
-
self.monkeypatch.setattr(
|
|
427
|
+
self.monkeypatch.setattr(
|
|
428
|
+
self.worker, "_getJobDetailsFromSacct", call_sacct_raises
|
|
429
|
+
)
|
|
386
430
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_scontrol)
|
|
387
|
-
job_ids = [
|
|
431
|
+
job_ids = ["787204"] # COMPLETED
|
|
388
432
|
expected_result = [(0, BatchJobExitReason.FINISHED)]
|
|
389
433
|
result = self.worker.coalesce_job_exit_codes(job_ids)
|
|
390
434
|
assert result == expected_result, f"{result} != {expected_result}"
|
|
@@ -394,9 +438,11 @@ class SlurmTest(ToilTest):
|
|
|
394
438
|
This test forces the use of `scontrol` to get job information, by letting `sacct`
|
|
395
439
|
raise an exception. Next, `scontrol` should also raise because it doesn't know the job.
|
|
396
440
|
"""
|
|
397
|
-
self.monkeypatch.setattr(
|
|
441
|
+
self.monkeypatch.setattr(
|
|
442
|
+
self.worker, "_getJobDetailsFromSacct", call_sacct_raises
|
|
443
|
+
)
|
|
398
444
|
self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_scontrol)
|
|
399
|
-
job_ids = [
|
|
445
|
+
job_ids = ["1234"] # Non-existent
|
|
400
446
|
try:
|
|
401
447
|
_ = self.worker.coalesce_job_exit_codes(job_ids)
|
|
402
448
|
except CalledProcessErrorStderr:
|
|
@@ -30,29 +30,27 @@ class CactusIntegrationTest(AbstractClusterTest):
|
|
|
30
30
|
)
|
|
31
31
|
self.leader = self.cluster.getLeader()
|
|
32
32
|
|
|
33
|
-
CACTUS_COMMIT_SHA =
|
|
33
|
+
CACTUS_COMMIT_SHA = (
|
|
34
|
+
os.environ["CACTUS_COMMIT_SHA"]
|
|
35
|
+
or "f5adf4013326322ae58ef1eccb8409b71d761583"
|
|
36
|
+
) # default cactus commit
|
|
34
37
|
|
|
35
38
|
# command to install and run cactus on the cluster
|
|
36
|
-
cactus_command = (
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
# run cactus
|
|
51
|
-
self.sshUtil(
|
|
52
|
-
[
|
|
53
|
-
"bash",
|
|
54
|
-
"-c",
|
|
55
|
-
cactus_command
|
|
56
|
-
]
|
|
39
|
+
cactus_command = (
|
|
40
|
+
"python -m virtualenv --system-site-packages venv && "
|
|
41
|
+
". venv/bin/activate && "
|
|
42
|
+
"git clone https://github.com/ComparativeGenomicsToolkit/cactus.git --recursive && "
|
|
43
|
+
"cd cactus && "
|
|
44
|
+
"git fetch origin && "
|
|
45
|
+
f"git checkout {CACTUS_COMMIT_SHA} && "
|
|
46
|
+
"git submodule update --init --recursive && "
|
|
47
|
+
"pip install --upgrade 'setuptools' pip && "
|
|
48
|
+
"pip install --upgrade . && "
|
|
49
|
+
"pip install --upgrade numpy psutil && "
|
|
50
|
+
"time cactus --batchSystem kubernetes --retryCount=3 "
|
|
51
|
+
f"--consCores 2 --binariesMode singularity --clean always {self.jobStore} "
|
|
52
|
+
"examples/evolverMammals.txt examples/evolverMammals.hal --root mr --defaultDisk 8G --logDebug"
|
|
57
53
|
)
|
|
58
54
|
|
|
55
|
+
# run cactus
|
|
56
|
+
self.sshUtil(["bash", "-c", cactus_command])
|