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.
Files changed (190) hide show
  1. toil/__init__.py +121 -83
  2. toil/batchSystems/__init__.py +1 -0
  3. toil/batchSystems/abstractBatchSystem.py +137 -77
  4. toil/batchSystems/abstractGridEngineBatchSystem.py +211 -101
  5. toil/batchSystems/awsBatch.py +237 -128
  6. toil/batchSystems/cleanup_support.py +22 -16
  7. toil/batchSystems/contained_executor.py +30 -26
  8. toil/batchSystems/gridengine.py +85 -49
  9. toil/batchSystems/htcondor.py +164 -87
  10. toil/batchSystems/kubernetes.py +622 -386
  11. toil/batchSystems/local_support.py +17 -12
  12. toil/batchSystems/lsf.py +132 -79
  13. toil/batchSystems/lsfHelper.py +13 -11
  14. toil/batchSystems/mesos/__init__.py +41 -29
  15. toil/batchSystems/mesos/batchSystem.py +288 -149
  16. toil/batchSystems/mesos/executor.py +77 -49
  17. toil/batchSystems/mesos/test/__init__.py +31 -23
  18. toil/batchSystems/options.py +38 -29
  19. toil/batchSystems/registry.py +53 -19
  20. toil/batchSystems/singleMachine.py +293 -123
  21. toil/batchSystems/slurm.py +489 -137
  22. toil/batchSystems/torque.py +46 -32
  23. toil/bus.py +141 -73
  24. toil/common.py +630 -359
  25. toil/cwl/__init__.py +1 -1
  26. toil/cwl/cwltoil.py +1114 -532
  27. toil/cwl/utils.py +17 -22
  28. toil/deferred.py +62 -41
  29. toil/exceptions.py +5 -3
  30. toil/fileStores/__init__.py +5 -5
  31. toil/fileStores/abstractFileStore.py +88 -57
  32. toil/fileStores/cachingFileStore.py +711 -247
  33. toil/fileStores/nonCachingFileStore.py +113 -75
  34. toil/job.py +988 -315
  35. toil/jobStores/abstractJobStore.py +387 -243
  36. toil/jobStores/aws/jobStore.py +727 -403
  37. toil/jobStores/aws/utils.py +161 -109
  38. toil/jobStores/conftest.py +1 -0
  39. toil/jobStores/fileJobStore.py +289 -151
  40. toil/jobStores/googleJobStore.py +137 -70
  41. toil/jobStores/utils.py +36 -15
  42. toil/leader.py +614 -269
  43. toil/lib/accelerators.py +115 -18
  44. toil/lib/aws/__init__.py +55 -28
  45. toil/lib/aws/ami.py +122 -87
  46. toil/lib/aws/iam.py +284 -108
  47. toil/lib/aws/s3.py +31 -0
  48. toil/lib/aws/session.py +193 -58
  49. toil/lib/aws/utils.py +238 -218
  50. toil/lib/bioio.py +13 -5
  51. toil/lib/compatibility.py +11 -6
  52. toil/lib/conversions.py +83 -49
  53. toil/lib/docker.py +131 -103
  54. toil/lib/ec2.py +322 -209
  55. toil/lib/ec2nodes.py +174 -106
  56. toil/lib/encryption/_dummy.py +5 -3
  57. toil/lib/encryption/_nacl.py +10 -6
  58. toil/lib/encryption/conftest.py +1 -0
  59. toil/lib/exceptions.py +26 -7
  60. toil/lib/expando.py +4 -2
  61. toil/lib/ftp_utils.py +217 -0
  62. toil/lib/generatedEC2Lists.py +127 -19
  63. toil/lib/humanize.py +6 -2
  64. toil/lib/integration.py +341 -0
  65. toil/lib/io.py +99 -11
  66. toil/lib/iterables.py +4 -2
  67. toil/lib/memoize.py +12 -8
  68. toil/lib/misc.py +65 -18
  69. toil/lib/objects.py +2 -2
  70. toil/lib/resources.py +19 -7
  71. toil/lib/retry.py +115 -77
  72. toil/lib/threading.py +282 -80
  73. toil/lib/throttle.py +15 -14
  74. toil/options/common.py +834 -401
  75. toil/options/cwl.py +175 -90
  76. toil/options/runner.py +50 -0
  77. toil/options/wdl.py +70 -19
  78. toil/provisioners/__init__.py +111 -46
  79. toil/provisioners/abstractProvisioner.py +322 -157
  80. toil/provisioners/aws/__init__.py +62 -30
  81. toil/provisioners/aws/awsProvisioner.py +980 -627
  82. toil/provisioners/clusterScaler.py +541 -279
  83. toil/provisioners/gceProvisioner.py +282 -179
  84. toil/provisioners/node.py +147 -79
  85. toil/realtimeLogger.py +34 -22
  86. toil/resource.py +137 -75
  87. toil/server/app.py +127 -61
  88. toil/server/celery_app.py +3 -1
  89. toil/server/cli/wes_cwl_runner.py +82 -53
  90. toil/server/utils.py +54 -28
  91. toil/server/wes/abstract_backend.py +64 -26
  92. toil/server/wes/amazon_wes_utils.py +21 -15
  93. toil/server/wes/tasks.py +121 -63
  94. toil/server/wes/toil_backend.py +142 -107
  95. toil/server/wsgi_app.py +4 -3
  96. toil/serviceManager.py +58 -22
  97. toil/statsAndLogging.py +148 -64
  98. toil/test/__init__.py +263 -179
  99. toil/test/batchSystems/batchSystemTest.py +438 -195
  100. toil/test/batchSystems/batch_system_plugin_test.py +18 -7
  101. toil/test/batchSystems/test_gridengine.py +173 -0
  102. toil/test/batchSystems/test_lsf_helper.py +67 -58
  103. toil/test/batchSystems/test_slurm.py +93 -47
  104. toil/test/cactus/test_cactus_integration.py +20 -22
  105. toil/test/cwl/cwlTest.py +271 -71
  106. toil/test/cwl/measure_default_memory.cwl +12 -0
  107. toil/test/cwl/not_run_required_input.cwl +29 -0
  108. toil/test/cwl/scatter_duplicate_outputs.cwl +40 -0
  109. toil/test/docs/scriptsTest.py +60 -34
  110. toil/test/jobStores/jobStoreTest.py +412 -235
  111. toil/test/lib/aws/test_iam.py +116 -48
  112. toil/test/lib/aws/test_s3.py +16 -9
  113. toil/test/lib/aws/test_utils.py +5 -6
  114. toil/test/lib/dockerTest.py +118 -141
  115. toil/test/lib/test_conversions.py +113 -115
  116. toil/test/lib/test_ec2.py +57 -49
  117. toil/test/lib/test_integration.py +104 -0
  118. toil/test/lib/test_misc.py +12 -5
  119. toil/test/mesos/MesosDataStructuresTest.py +23 -10
  120. toil/test/mesos/helloWorld.py +7 -6
  121. toil/test/mesos/stress.py +25 -20
  122. toil/test/options/options.py +7 -2
  123. toil/test/provisioners/aws/awsProvisionerTest.py +293 -140
  124. toil/test/provisioners/clusterScalerTest.py +440 -250
  125. toil/test/provisioners/clusterTest.py +81 -42
  126. toil/test/provisioners/gceProvisionerTest.py +174 -100
  127. toil/test/provisioners/provisionerTest.py +25 -13
  128. toil/test/provisioners/restartScript.py +5 -4
  129. toil/test/server/serverTest.py +188 -141
  130. toil/test/sort/restart_sort.py +137 -68
  131. toil/test/sort/sort.py +134 -66
  132. toil/test/sort/sortTest.py +91 -49
  133. toil/test/src/autoDeploymentTest.py +140 -100
  134. toil/test/src/busTest.py +20 -18
  135. toil/test/src/checkpointTest.py +8 -2
  136. toil/test/src/deferredFunctionTest.py +49 -35
  137. toil/test/src/dockerCheckTest.py +33 -26
  138. toil/test/src/environmentTest.py +20 -10
  139. toil/test/src/fileStoreTest.py +538 -271
  140. toil/test/src/helloWorldTest.py +7 -4
  141. toil/test/src/importExportFileTest.py +61 -31
  142. toil/test/src/jobDescriptionTest.py +32 -17
  143. toil/test/src/jobEncapsulationTest.py +2 -0
  144. toil/test/src/jobFileStoreTest.py +74 -50
  145. toil/test/src/jobServiceTest.py +187 -73
  146. toil/test/src/jobTest.py +120 -70
  147. toil/test/src/miscTests.py +19 -18
  148. toil/test/src/promisedRequirementTest.py +82 -36
  149. toil/test/src/promisesTest.py +7 -6
  150. toil/test/src/realtimeLoggerTest.py +6 -6
  151. toil/test/src/regularLogTest.py +71 -37
  152. toil/test/src/resourceTest.py +80 -49
  153. toil/test/src/restartDAGTest.py +36 -22
  154. toil/test/src/resumabilityTest.py +9 -2
  155. toil/test/src/retainTempDirTest.py +45 -14
  156. toil/test/src/systemTest.py +12 -8
  157. toil/test/src/threadingTest.py +44 -25
  158. toil/test/src/toilContextManagerTest.py +10 -7
  159. toil/test/src/userDefinedJobArgTypeTest.py +8 -5
  160. toil/test/src/workerTest.py +33 -16
  161. toil/test/utils/toilDebugTest.py +70 -58
  162. toil/test/utils/toilKillTest.py +4 -5
  163. toil/test/utils/utilsTest.py +239 -102
  164. toil/test/wdl/wdltoil_test.py +789 -148
  165. toil/test/wdl/wdltoil_test_kubernetes.py +37 -23
  166. toil/toilState.py +52 -26
  167. toil/utils/toilConfig.py +13 -4
  168. toil/utils/toilDebugFile.py +44 -27
  169. toil/utils/toilDebugJob.py +85 -25
  170. toil/utils/toilDestroyCluster.py +11 -6
  171. toil/utils/toilKill.py +8 -3
  172. toil/utils/toilLaunchCluster.py +251 -145
  173. toil/utils/toilMain.py +37 -16
  174. toil/utils/toilRsyncCluster.py +27 -14
  175. toil/utils/toilSshCluster.py +45 -22
  176. toil/utils/toilStats.py +75 -36
  177. toil/utils/toilStatus.py +226 -119
  178. toil/utils/toilUpdateEC2Instances.py +3 -1
  179. toil/version.py +11 -11
  180. toil/wdl/utils.py +5 -5
  181. toil/wdl/wdltoil.py +3513 -1052
  182. toil/worker.py +269 -128
  183. toil-8.0.0.dist-info/METADATA +173 -0
  184. toil-8.0.0.dist-info/RECORD +253 -0
  185. {toil-7.0.0.dist-info → toil-8.0.0.dist-info}/WHEEL +1 -1
  186. toil-7.0.0.dist-info/METADATA +0 -158
  187. toil-7.0.0.dist-info/RECORD +0 -244
  188. {toil-7.0.0.dist-info → toil-8.0.0.dist-info}/LICENSE +0 -0
  189. {toil-7.0.0.dist-info → toil-8.0.0.dist-info}/entry_points.txt +0 -0
  190. {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 BatchJobExitReason, EXIT_STATUS_UNAVAILABLE_VALUE
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
- 789724: textwrap.dedent("""\
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
- 789728: textwrap.dedent("""\
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(1, "slurm_load_jobs error: Invalid job id specified")
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 + '\n'
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(1, "sacct: error: Problem talking to the database: "
160
- "Connection timed out")
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 = 'always'
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 = {754725: ("TIMEOUT", 0), 789456: ("FAILED", 1), 789724: ("RUNNING", 0),
222
- 789868: ("PENDING", 0), 789869: ("COMPLETED", 0)}
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 = {609663: ("FAILED", 130), 767925: ("FAILED", 2), 1234: (None, None),
229
- 1235: (None, None), 765096: ("FAILED", 137)}
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 = {787204: ("COMPLETED", 0), 789724: ("RUNNING", 0), 789728: ("PENDING", 0)}
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 = {787204: ("COMPLETED", 0), 789724: ("RUNNING", 0), 1234: (None, None)}
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 = '785023' # FAILED
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 = '1234' # Non-existent
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(self.worker, "_getJobDetailsFromSacct", call_sacct_raises)
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 = '787204' # COMPLETED
307
- expected_result = (0, BatchJobExitReason.FINISHED)
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(self.worker, "_getJobDetailsFromSacct", call_sacct_raises)
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 = '1234' # Non-existent
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 = ['785023'] # FAILED
333
- expected_result = [(127, BatchJobExitReason.FAILED)]
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 = ['1234'] # Non-existent
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 = ['754725', # TIMEOUT,
347
- '789456', # FAILED,
348
- '789724', # RUNNING,
349
- '789868', # PENDING,
350
- '789869'] # COMPLETED
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 = ['609663', # FAILED (SIGINT)
365
- '767925', # FAILED,
366
- '789724', # RUNNING,
367
- '999999', # Non-existent,
368
- '789869'] # COMPLETED
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(self.worker, "_getJobDetailsFromSacct", call_sacct_raises)
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 = ['787204'] # COMPLETED
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(self.worker, "_getJobDetailsFromSacct", call_sacct_raises)
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 = ['1234'] # Non-existent
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 = os.environ["CACTUS_COMMIT_SHA"] or "f5adf4013326322ae58ef1eccb8409b71d761583" # default cactus commit
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 = ("python -m virtualenv --system-site-packages venv && "
37
- ". venv/bin/activate && "
38
- "git clone https://github.com/ComparativeGenomicsToolkit/cactus.git --recursive && "
39
- "cd cactus && "
40
- "git fetch origin && "
41
- f"git checkout {CACTUS_COMMIT_SHA} && "
42
- "git submodule update --init --recursive && "
43
- "pip install --upgrade 'setuptools<66' pip && "
44
- "pip install --upgrade . && "
45
- "pip install --upgrade numpy psutil && "
46
- "time cactus --batchSystem kubernetes --retryCount=3 "
47
- f"--consCores 2 --binariesMode singularity --clean always {self.jobStore} "
48
- "examples/evolverMammals.txt examples/evolverMammals.hal --root mr --defaultDisk 8G --logDebug")
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])