toil 6.1.0a1__py3-none-any.whl → 7.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 (104) hide show
  1. toil/__init__.py +1 -232
  2. toil/batchSystems/abstractBatchSystem.py +41 -17
  3. toil/batchSystems/abstractGridEngineBatchSystem.py +79 -65
  4. toil/batchSystems/awsBatch.py +8 -8
  5. toil/batchSystems/cleanup_support.py +7 -3
  6. toil/batchSystems/contained_executor.py +4 -5
  7. toil/batchSystems/gridengine.py +1 -1
  8. toil/batchSystems/htcondor.py +5 -5
  9. toil/batchSystems/kubernetes.py +25 -11
  10. toil/batchSystems/local_support.py +3 -3
  11. toil/batchSystems/lsf.py +9 -9
  12. toil/batchSystems/mesos/batchSystem.py +4 -4
  13. toil/batchSystems/mesos/executor.py +3 -2
  14. toil/batchSystems/options.py +9 -0
  15. toil/batchSystems/singleMachine.py +11 -10
  16. toil/batchSystems/slurm.py +129 -16
  17. toil/batchSystems/torque.py +1 -1
  18. toil/bus.py +45 -3
  19. toil/common.py +56 -31
  20. toil/cwl/cwltoil.py +442 -371
  21. toil/deferred.py +1 -1
  22. toil/exceptions.py +1 -1
  23. toil/fileStores/abstractFileStore.py +69 -20
  24. toil/fileStores/cachingFileStore.py +6 -22
  25. toil/fileStores/nonCachingFileStore.py +6 -15
  26. toil/job.py +270 -86
  27. toil/jobStores/abstractJobStore.py +37 -31
  28. toil/jobStores/aws/jobStore.py +280 -218
  29. toil/jobStores/aws/utils.py +60 -31
  30. toil/jobStores/conftest.py +2 -2
  31. toil/jobStores/fileJobStore.py +3 -3
  32. toil/jobStores/googleJobStore.py +3 -4
  33. toil/leader.py +89 -38
  34. toil/lib/aws/__init__.py +26 -10
  35. toil/lib/aws/iam.py +2 -2
  36. toil/lib/aws/session.py +62 -22
  37. toil/lib/aws/utils.py +73 -37
  38. toil/lib/conversions.py +24 -1
  39. toil/lib/ec2.py +118 -69
  40. toil/lib/expando.py +1 -1
  41. toil/lib/generatedEC2Lists.py +8 -8
  42. toil/lib/io.py +42 -4
  43. toil/lib/misc.py +1 -3
  44. toil/lib/resources.py +57 -16
  45. toil/lib/retry.py +12 -5
  46. toil/lib/threading.py +29 -14
  47. toil/lib/throttle.py +1 -1
  48. toil/options/common.py +31 -30
  49. toil/options/wdl.py +5 -0
  50. toil/provisioners/__init__.py +9 -3
  51. toil/provisioners/abstractProvisioner.py +12 -2
  52. toil/provisioners/aws/__init__.py +20 -15
  53. toil/provisioners/aws/awsProvisioner.py +406 -329
  54. toil/provisioners/gceProvisioner.py +2 -2
  55. toil/provisioners/node.py +13 -5
  56. toil/server/app.py +1 -1
  57. toil/statsAndLogging.py +93 -23
  58. toil/test/__init__.py +27 -12
  59. toil/test/batchSystems/batchSystemTest.py +40 -33
  60. toil/test/batchSystems/batch_system_plugin_test.py +79 -0
  61. toil/test/batchSystems/test_slurm.py +22 -7
  62. toil/test/cactus/__init__.py +0 -0
  63. toil/test/cactus/test_cactus_integration.py +58 -0
  64. toil/test/cwl/cwlTest.py +245 -236
  65. toil/test/cwl/seqtk_seq.cwl +1 -1
  66. toil/test/docs/scriptsTest.py +11 -14
  67. toil/test/jobStores/jobStoreTest.py +40 -54
  68. toil/test/lib/aws/test_iam.py +2 -2
  69. toil/test/lib/test_ec2.py +1 -1
  70. toil/test/options/__init__.py +13 -0
  71. toil/test/options/options.py +37 -0
  72. toil/test/provisioners/aws/awsProvisionerTest.py +51 -34
  73. toil/test/provisioners/clusterTest.py +99 -16
  74. toil/test/server/serverTest.py +2 -2
  75. toil/test/src/autoDeploymentTest.py +1 -1
  76. toil/test/src/dockerCheckTest.py +2 -1
  77. toil/test/src/environmentTest.py +125 -0
  78. toil/test/src/fileStoreTest.py +1 -1
  79. toil/test/src/jobDescriptionTest.py +18 -8
  80. toil/test/src/jobTest.py +1 -1
  81. toil/test/src/realtimeLoggerTest.py +4 -0
  82. toil/test/src/workerTest.py +52 -19
  83. toil/test/utils/toilDebugTest.py +62 -4
  84. toil/test/utils/utilsTest.py +23 -21
  85. toil/test/wdl/wdltoil_test.py +49 -21
  86. toil/test/wdl/wdltoil_test_kubernetes.py +77 -0
  87. toil/toilState.py +68 -9
  88. toil/utils/toilDebugFile.py +1 -1
  89. toil/utils/toilDebugJob.py +153 -26
  90. toil/utils/toilLaunchCluster.py +12 -2
  91. toil/utils/toilRsyncCluster.py +7 -2
  92. toil/utils/toilSshCluster.py +7 -3
  93. toil/utils/toilStats.py +310 -266
  94. toil/utils/toilStatus.py +98 -52
  95. toil/version.py +11 -11
  96. toil/wdl/wdltoil.py +644 -225
  97. toil/worker.py +125 -83
  98. {toil-6.1.0a1.dist-info → toil-7.0.0.dist-info}/LICENSE +25 -0
  99. toil-7.0.0.dist-info/METADATA +158 -0
  100. {toil-6.1.0a1.dist-info → toil-7.0.0.dist-info}/RECORD +103 -96
  101. {toil-6.1.0a1.dist-info → toil-7.0.0.dist-info}/WHEEL +1 -1
  102. toil-6.1.0a1.dist-info/METADATA +0 -125
  103. {toil-6.1.0a1.dist-info → toil-7.0.0.dist-info}/entry_points.txt +0 -0
  104. {toil-6.1.0a1.dist-info → toil-7.0.0.dist-info}/top_level.txt +0 -0
@@ -4,6 +4,7 @@ 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
8
  from toil.common import Config
8
9
  from toil.lib.misc import CalledProcessErrorStderr
9
10
  from toil.test import ToilTest
@@ -192,7 +193,7 @@ class SlurmTest(ToilTest):
192
193
 
193
194
  def setUp(self):
194
195
  self.monkeypatch = pytest.MonkeyPatch()
195
- self.worker = toil.batchSystems.slurm.SlurmBatchSystem.Worker(
196
+ self.worker = toil.batchSystems.slurm.SlurmBatchSystem.GridEngineThread(
196
197
  newJobsQueue=Queue(),
197
198
  updatedJobsQueue=Queue(),
198
199
  killQueue=Queue(),
@@ -284,7 +285,7 @@ class SlurmTest(ToilTest):
284
285
  def test_getJobExitCode_job_exists(self):
285
286
  self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
286
287
  job_id = '785023' # FAILED
287
- expected_result = 127
288
+ expected_result = (127, BatchJobExitReason.FAILED)
288
289
  result = self.worker.getJobExitCode(job_id)
289
290
  assert result == expected_result, f"{result} != {expected_result}"
290
291
 
@@ -303,7 +304,7 @@ class SlurmTest(ToilTest):
303
304
  self.monkeypatch.setattr(self.worker, "_getJobDetailsFromSacct", call_sacct_raises)
304
305
  self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_scontrol)
305
306
  job_id = '787204' # COMPLETED
306
- expected_result = 0
307
+ expected_result = (0, BatchJobExitReason.FINISHED)
307
308
  result = self.worker.getJobExitCode(job_id)
308
309
  assert result == expected_result, f"{result} != {expected_result}"
309
310
 
@@ -329,7 +330,7 @@ class SlurmTest(ToilTest):
329
330
  def test_coalesce_job_exit_codes_one_exists(self):
330
331
  self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_sacct)
331
332
  job_ids = ['785023'] # FAILED
332
- expected_result = [127]
333
+ expected_result = [(127, BatchJobExitReason.FAILED)]
333
334
  result = self.worker.coalesce_job_exit_codes(job_ids)
334
335
  assert result == expected_result, f"{result} != {expected_result}"
335
336
 
@@ -347,7 +348,14 @@ class SlurmTest(ToilTest):
347
348
  '789724', # RUNNING,
348
349
  '789868', # PENDING,
349
350
  '789869'] # COMPLETED
350
- expected_result = [0, 1, None, None, 0] # RUNNING and PENDING jobs should return None
351
+ # RUNNING and PENDING jobs should return None
352
+ expected_result = [
353
+ (EXIT_STATUS_UNAVAILABLE_VALUE, BatchJobExitReason.KILLED),
354
+ (1, BatchJobExitReason.FAILED),
355
+ None,
356
+ None,
357
+ (0, BatchJobExitReason.FINISHED)
358
+ ]
351
359
  result = self.worker.coalesce_job_exit_codes(job_ids)
352
360
  assert result == expected_result, f"{result} != {expected_result}"
353
361
 
@@ -358,7 +366,14 @@ class SlurmTest(ToilTest):
358
366
  '789724', # RUNNING,
359
367
  '999999', # Non-existent,
360
368
  '789869'] # COMPLETED
361
- expected_result = [130, 2, None, None, 0] # RUNNING job should return None
369
+ # RUNNING job should return None
370
+ expected_result = [
371
+ (130, BatchJobExitReason.FAILED),
372
+ (2, BatchJobExitReason.FAILED),
373
+ None,
374
+ None,
375
+ (0, BatchJobExitReason.FINISHED)
376
+ ]
362
377
  result = self.worker.coalesce_job_exit_codes(job_ids)
363
378
  assert result == expected_result, f"{result} != {expected_result}"
364
379
 
@@ -370,7 +385,7 @@ class SlurmTest(ToilTest):
370
385
  self.monkeypatch.setattr(self.worker, "_getJobDetailsFromSacct", call_sacct_raises)
371
386
  self.monkeypatch.setattr(toil.batchSystems.slurm, "call_command", call_scontrol)
372
387
  job_ids = ['787204'] # COMPLETED
373
- expected_result = [0]
388
+ expected_result = [(0, BatchJobExitReason.FINISHED)]
374
389
  result = self.worker.coalesce_job_exit_codes(job_ids)
375
390
  assert result == expected_result, f"{result} != {expected_result}"
376
391
 
File without changes
@@ -0,0 +1,58 @@
1
+ import os
2
+ import uuid
3
+
4
+ from toil.provisioners import cluster_factory
5
+ from toil.test.provisioners.clusterTest import AbstractClusterTest
6
+
7
+
8
+ class CactusIntegrationTest(AbstractClusterTest):
9
+ """
10
+ Run the Cactus Integration test on a Kubernetes AWS cluster
11
+ """
12
+
13
+ def __init__(self, methodName):
14
+ super().__init__(methodName=methodName)
15
+ self.clusterName = "cactus-test-" + str(uuid.uuid4())
16
+ self.leaderNodeType = "t2.medium"
17
+ self.clusterType = "kubernetes"
18
+
19
+ def setUp(self):
20
+ super().setUp()
21
+ self.jobStore = f"aws:{self.awsRegion()}:cluster-{uuid.uuid4()}"
22
+
23
+ def test_cactus_integration(self):
24
+ # Make a cluster with worker nodes
25
+ self.createClusterUtil(args=["--nodeTypes=t2.xlarge", "-w=1-3"])
26
+ # get the leader so we know the IP address - we don't need to wait since create cluster
27
+ # already ensures the leader is running
28
+ self.cluster = cluster_factory(
29
+ provisioner="aws", zone=self.zone, clusterName=self.clusterName
30
+ )
31
+ self.leader = self.cluster.getLeader()
32
+
33
+ CACTUS_COMMIT_SHA = os.environ["CACTUS_COMMIT_SHA"] or "f5adf4013326322ae58ef1eccb8409b71d761583" # default cactus commit
34
+
35
+ # 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
+ ]
57
+ )
58
+