toil 6.1.0a1__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 (193) hide show
  1. toil/__init__.py +122 -315
  2. toil/batchSystems/__init__.py +1 -0
  3. toil/batchSystems/abstractBatchSystem.py +173 -89
  4. toil/batchSystems/abstractGridEngineBatchSystem.py +272 -148
  5. toil/batchSystems/awsBatch.py +244 -135
  6. toil/batchSystems/cleanup_support.py +26 -16
  7. toil/batchSystems/contained_executor.py +31 -28
  8. toil/batchSystems/gridengine.py +86 -50
  9. toil/batchSystems/htcondor.py +166 -89
  10. toil/batchSystems/kubernetes.py +632 -382
  11. toil/batchSystems/local_support.py +20 -15
  12. toil/batchSystems/lsf.py +134 -81
  13. toil/batchSystems/lsfHelper.py +13 -11
  14. toil/batchSystems/mesos/__init__.py +41 -29
  15. toil/batchSystems/mesos/batchSystem.py +290 -151
  16. toil/batchSystems/mesos/executor.py +79 -50
  17. toil/batchSystems/mesos/test/__init__.py +31 -23
  18. toil/batchSystems/options.py +46 -28
  19. toil/batchSystems/registry.py +53 -19
  20. toil/batchSystems/singleMachine.py +296 -125
  21. toil/batchSystems/slurm.py +603 -138
  22. toil/batchSystems/torque.py +47 -33
  23. toil/bus.py +186 -76
  24. toil/common.py +664 -368
  25. toil/cwl/__init__.py +1 -1
  26. toil/cwl/cwltoil.py +1136 -483
  27. toil/cwl/utils.py +17 -22
  28. toil/deferred.py +63 -42
  29. toil/exceptions.py +5 -3
  30. toil/fileStores/__init__.py +5 -5
  31. toil/fileStores/abstractFileStore.py +140 -60
  32. toil/fileStores/cachingFileStore.py +717 -269
  33. toil/fileStores/nonCachingFileStore.py +116 -87
  34. toil/job.py +1225 -368
  35. toil/jobStores/abstractJobStore.py +416 -266
  36. toil/jobStores/aws/jobStore.py +863 -477
  37. toil/jobStores/aws/utils.py +201 -120
  38. toil/jobStores/conftest.py +3 -2
  39. toil/jobStores/fileJobStore.py +292 -154
  40. toil/jobStores/googleJobStore.py +140 -74
  41. toil/jobStores/utils.py +36 -15
  42. toil/leader.py +668 -272
  43. toil/lib/accelerators.py +115 -18
  44. toil/lib/aws/__init__.py +74 -31
  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 +214 -39
  49. toil/lib/aws/utils.py +287 -231
  50. toil/lib/bioio.py +13 -5
  51. toil/lib/compatibility.py +11 -6
  52. toil/lib/conversions.py +104 -47
  53. toil/lib/docker.py +131 -103
  54. toil/lib/ec2.py +361 -199
  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 +5 -3
  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 +141 -15
  66. toil/lib/iterables.py +4 -2
  67. toil/lib/memoize.py +12 -8
  68. toil/lib/misc.py +66 -21
  69. toil/lib/objects.py +2 -2
  70. toil/lib/resources.py +68 -15
  71. toil/lib/retry.py +126 -81
  72. toil/lib/threading.py +299 -82
  73. toil/lib/throttle.py +16 -15
  74. toil/options/common.py +843 -409
  75. toil/options/cwl.py +175 -90
  76. toil/options/runner.py +50 -0
  77. toil/options/wdl.py +73 -17
  78. toil/provisioners/__init__.py +117 -46
  79. toil/provisioners/abstractProvisioner.py +332 -157
  80. toil/provisioners/aws/__init__.py +70 -33
  81. toil/provisioners/aws/awsProvisioner.py +1145 -715
  82. toil/provisioners/clusterScaler.py +541 -279
  83. toil/provisioners/gceProvisioner.py +282 -179
  84. toil/provisioners/node.py +155 -79
  85. toil/realtimeLogger.py +34 -22
  86. toil/resource.py +137 -75
  87. toil/server/app.py +128 -62
  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 +224 -70
  98. toil/test/__init__.py +282 -183
  99. toil/test/batchSystems/batchSystemTest.py +460 -210
  100. toil/test/batchSystems/batch_system_plugin_test.py +90 -0
  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 +110 -49
  104. toil/test/cactus/__init__.py +0 -0
  105. toil/test/cactus/test_cactus_integration.py +56 -0
  106. toil/test/cwl/cwlTest.py +496 -287
  107. toil/test/cwl/measure_default_memory.cwl +12 -0
  108. toil/test/cwl/not_run_required_input.cwl +29 -0
  109. toil/test/cwl/scatter_duplicate_outputs.cwl +40 -0
  110. toil/test/cwl/seqtk_seq.cwl +1 -1
  111. toil/test/docs/scriptsTest.py +69 -46
  112. toil/test/jobStores/jobStoreTest.py +427 -264
  113. toil/test/lib/aws/test_iam.py +118 -50
  114. toil/test/lib/aws/test_s3.py +16 -9
  115. toil/test/lib/aws/test_utils.py +5 -6
  116. toil/test/lib/dockerTest.py +118 -141
  117. toil/test/lib/test_conversions.py +113 -115
  118. toil/test/lib/test_ec2.py +58 -50
  119. toil/test/lib/test_integration.py +104 -0
  120. toil/test/lib/test_misc.py +12 -5
  121. toil/test/mesos/MesosDataStructuresTest.py +23 -10
  122. toil/test/mesos/helloWorld.py +7 -6
  123. toil/test/mesos/stress.py +25 -20
  124. toil/test/options/__init__.py +13 -0
  125. toil/test/options/options.py +42 -0
  126. toil/test/provisioners/aws/awsProvisionerTest.py +320 -150
  127. toil/test/provisioners/clusterScalerTest.py +440 -250
  128. toil/test/provisioners/clusterTest.py +166 -44
  129. toil/test/provisioners/gceProvisionerTest.py +174 -100
  130. toil/test/provisioners/provisionerTest.py +25 -13
  131. toil/test/provisioners/restartScript.py +5 -4
  132. toil/test/server/serverTest.py +188 -141
  133. toil/test/sort/restart_sort.py +137 -68
  134. toil/test/sort/sort.py +134 -66
  135. toil/test/sort/sortTest.py +91 -49
  136. toil/test/src/autoDeploymentTest.py +141 -101
  137. toil/test/src/busTest.py +20 -18
  138. toil/test/src/checkpointTest.py +8 -2
  139. toil/test/src/deferredFunctionTest.py +49 -35
  140. toil/test/src/dockerCheckTest.py +32 -24
  141. toil/test/src/environmentTest.py +135 -0
  142. toil/test/src/fileStoreTest.py +539 -272
  143. toil/test/src/helloWorldTest.py +7 -4
  144. toil/test/src/importExportFileTest.py +61 -31
  145. toil/test/src/jobDescriptionTest.py +46 -21
  146. toil/test/src/jobEncapsulationTest.py +2 -0
  147. toil/test/src/jobFileStoreTest.py +74 -50
  148. toil/test/src/jobServiceTest.py +187 -73
  149. toil/test/src/jobTest.py +121 -71
  150. toil/test/src/miscTests.py +19 -18
  151. toil/test/src/promisedRequirementTest.py +82 -36
  152. toil/test/src/promisesTest.py +7 -6
  153. toil/test/src/realtimeLoggerTest.py +10 -6
  154. toil/test/src/regularLogTest.py +71 -37
  155. toil/test/src/resourceTest.py +80 -49
  156. toil/test/src/restartDAGTest.py +36 -22
  157. toil/test/src/resumabilityTest.py +9 -2
  158. toil/test/src/retainTempDirTest.py +45 -14
  159. toil/test/src/systemTest.py +12 -8
  160. toil/test/src/threadingTest.py +44 -25
  161. toil/test/src/toilContextManagerTest.py +10 -7
  162. toil/test/src/userDefinedJobArgTypeTest.py +8 -5
  163. toil/test/src/workerTest.py +73 -23
  164. toil/test/utils/toilDebugTest.py +103 -33
  165. toil/test/utils/toilKillTest.py +4 -5
  166. toil/test/utils/utilsTest.py +245 -106
  167. toil/test/wdl/wdltoil_test.py +818 -149
  168. toil/test/wdl/wdltoil_test_kubernetes.py +91 -0
  169. toil/toilState.py +120 -35
  170. toil/utils/toilConfig.py +13 -4
  171. toil/utils/toilDebugFile.py +44 -27
  172. toil/utils/toilDebugJob.py +214 -27
  173. toil/utils/toilDestroyCluster.py +11 -6
  174. toil/utils/toilKill.py +8 -3
  175. toil/utils/toilLaunchCluster.py +256 -140
  176. toil/utils/toilMain.py +37 -16
  177. toil/utils/toilRsyncCluster.py +32 -14
  178. toil/utils/toilSshCluster.py +49 -22
  179. toil/utils/toilStats.py +356 -273
  180. toil/utils/toilStatus.py +292 -139
  181. toil/utils/toilUpdateEC2Instances.py +3 -1
  182. toil/version.py +12 -12
  183. toil/wdl/utils.py +5 -5
  184. toil/wdl/wdltoil.py +3913 -1033
  185. toil/worker.py +367 -184
  186. {toil-6.1.0a1.dist-info → toil-8.0.0.dist-info}/LICENSE +25 -0
  187. toil-8.0.0.dist-info/METADATA +173 -0
  188. toil-8.0.0.dist-info/RECORD +253 -0
  189. {toil-6.1.0a1.dist-info → toil-8.0.0.dist-info}/WHEEL +1 -1
  190. toil-6.1.0a1.dist-info/METADATA +0 -125
  191. toil-6.1.0a1.dist-info/RECORD +0 -237
  192. {toil-6.1.0a1.dist-info → toil-8.0.0.dist-info}/entry_points.txt +0 -0
  193. {toil-6.1.0a1.dist-info → toil-8.0.0.dist-info}/top_level.txt +0 -0
@@ -23,14 +23,15 @@ from toil.job import Job
23
23
  childMessage = "The child job is now running!"
24
24
  parentMessage = "The parent job is now running!"
25
25
 
26
+
26
27
  def hello_world(job):
27
28
 
28
29
  job.fileStore.log_to_leader(parentMessage)
29
- with open('foo_bam.txt', 'w') as handle:
30
- handle.write('\nThis is a triumph...\n')
30
+ with open("foo_bam.txt", "w") as handle:
31
+ handle.write("\nThis is a triumph...\n")
31
32
 
32
33
  # Assign FileStoreID to a given file
33
- foo_bam = job.fileStore.writeGlobalFile('foo_bam.txt')
34
+ foo_bam = job.fileStore.writeGlobalFile("foo_bam.txt")
34
35
 
35
36
  # Spawn child
36
37
  job.addChildJobFn(hello_world_child, foo_bam, memory=100, cores=0.5, disk="3G")
@@ -43,13 +44,13 @@ def hello_world_child(job, hw):
43
44
  # NOTE: path and the udpated file are stored to /tmp
44
45
  # If we want to SAVE our changes to this tmp file, we must write it out.
45
46
  with open(path) as r:
46
- with open('bar_bam.txt', 'w') as handle:
47
+ with open("bar_bam.txt", "w") as handle:
47
48
  for line in r.readlines():
48
49
  handle.write(line)
49
50
 
50
51
  # Assign FileStoreID to a given file
51
52
  # can also use: job.updateGlobalFile() given the FileStoreID instantiation.
52
- job.fileStore.writeGlobalFile('bar_bam.txt')
53
+ job.fileStore.writeGlobalFile("bar_bam.txt")
53
54
 
54
55
 
55
56
  def main():
@@ -67,5 +68,5 @@ def main():
67
68
  toil.start(i)
68
69
 
69
70
 
70
- if __name__ == '__main__':
71
+ if __name__ == "__main__":
71
72
  main()
toil/test/mesos/stress.py CHANGED
@@ -17,58 +17,63 @@ from configargparse import ArgumentParser
17
17
  from toil.job import Job
18
18
 
19
19
 
20
- def touchFile( fileStore ):
20
+ def touchFile(fileStore):
21
21
  with fileStore.writeGlobalFileStream() as (f, id):
22
- f.write( "This is a triumph" )
22
+ f.write("This is a triumph")
23
+
23
24
 
24
25
  class LongTestJob(Job):
25
26
  def __init__(self, numJobs):
26
- Job.__init__(self, memory=100000, cores=0.01)
27
+ Job.__init__(self, memory=100000, cores=0.01)
27
28
  self.numJobs = numJobs
28
29
 
29
30
  def run(self, fileStore):
30
- for i in range(0,self.numJobs):
31
+ for i in range(0, self.numJobs):
31
32
  self.addChild(HelloWorldJob(i))
32
33
  self.addFollowOn(LongTestFollowOn())
33
34
 
35
+
34
36
  class LongTestFollowOn(Job):
35
37
 
36
38
  def __init__(self):
37
- Job.__init__(self, memory=1000000, cores=0.01)
39
+ Job.__init__(self, memory=1000000, cores=0.01)
38
40
 
39
41
  def run(self, fileStore):
40
- touchFile( fileStore )
42
+ touchFile(fileStore)
41
43
 
42
- class HelloWorldJob(Job):
43
44
 
44
- def __init__(self,i):
45
- Job.__init__(self, memory=100000, cores=0.01)
46
- self.i=i
45
+ class HelloWorldJob(Job):
47
46
 
47
+ def __init__(self, i):
48
+ Job.__init__(self, memory=100000, cores=0.01)
49
+ self.i = i
48
50
 
49
51
  def run(self, fileStore):
50
- touchFile( fileStore )
52
+ touchFile(fileStore)
51
53
  self.addFollowOn(HelloWorldFollowOn(self.i))
52
54
 
55
+
53
56
  class HelloWorldFollowOn(Job):
54
57
 
55
- def __init__(self,i):
56
- Job.__init__(self, memory=200000, cores=0.01)
58
+ def __init__(self, i):
59
+ Job.__init__(self, memory=200000, cores=0.01)
57
60
  self.i = i
58
61
 
59
62
  def run(self, fileStore):
60
- touchFile( fileStore)
63
+ touchFile(fileStore)
64
+
61
65
 
62
66
  def main(numJobs):
63
67
  # Boilerplate -- startToil requires options
64
68
  parser = ArgumentParser()
65
69
  Job.Runner.addToilOptions(parser)
66
- options = parser.parse_args( args=['./toilTest'] )
67
- options.batchSystem="mesos"
68
- options.mesos_endpoint="localhost:5050"
70
+ options = parser.parse_args(args=["./toilTest"])
71
+ options.batchSystem = "mesos"
72
+ options.mesos_endpoint = "localhost:5050"
69
73
  # Launch first toil Job
70
- i = LongTestJob( numJobs )
71
- Job.Runner.startToil(i, options )
74
+ i = LongTestJob(numJobs)
75
+ Job.Runner.startToil(i, options)
76
+
72
77
 
73
- if __name__=="__main__":
78
+ if __name__ == "__main__":
74
79
  main(numJobs=5)
@@ -0,0 +1,13 @@
1
+ # Copyright (C) 2015-2021 Regents of the University of California
2
+ #
3
+ # Licensed under the Apache License, Version 2.0 (the "License");
4
+ # you may not use this file except in compliance with the License.
5
+ # You may obtain a copy of the License at
6
+ #
7
+ # http://www.apache.org/licenses/LICENSE-2.0
8
+ #
9
+ # Unless required by applicable law or agreed to in writing, software
10
+ # distributed under the License is distributed on an "AS IS" BASIS,
11
+ # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ # See the License for the specific language governing permissions and
13
+ # limitations under the License.
@@ -0,0 +1,42 @@
1
+ from configargparse import ArgParser
2
+
3
+ from toil.common import Toil, addOptions
4
+ from toil.test import ToilTest
5
+
6
+
7
+ class OptionsTest(ToilTest):
8
+ """
9
+ Class to test functionality of all Toil options
10
+ """
11
+
12
+ def test_default_caching_slurm(self):
13
+ """
14
+ Test to ensure that caching will be set to false when running on Slurm
15
+ :return:
16
+ """
17
+ parser = ArgParser()
18
+ addOptions(parser, jobstore_as_flag=True, wdl=False, cwl=False)
19
+ test_args = ["--jobstore=example-jobstore", "--batchSystem=slurm"]
20
+ options = parser.parse_args(test_args)
21
+ with Toil(options) as toil:
22
+ caching_value = toil.config.caching
23
+ self.assertEqual(caching_value, False)
24
+
25
+ def test_caching_option_priority(self):
26
+ """
27
+ Test to ensure that the --caching option takes priority over the default_caching() return value
28
+ :return:
29
+ """
30
+ parser = ArgParser()
31
+ addOptions(parser, jobstore_as_flag=True, wdl=False, cwl=False)
32
+ # the kubernetes batchsystem (and I think all batchsystems including singlemachine) return False
33
+ # for default_caching
34
+ test_args = [
35
+ "--jobstore=example-jobstore",
36
+ "--batchSystem=kubernetes",
37
+ "--caching=True",
38
+ ]
39
+ options = parser.parse_args(test_args)
40
+ with Toil(options) as toil:
41
+ caching_value = toil.config.caching
42
+ self.assertEqual(caching_value, True)