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
toil/options/cwl.py CHANGED
@@ -15,45 +15,66 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
15
15
  :return: None
16
16
  """
17
17
  suppress_help = SUPPRESS if suppress else None
18
+
19
+ # These are options that we have to match cwltool
20
+ # TODO: Are there still any Toil-specific options in here?
18
21
  parser.add_argument("--not-strict", action="store_true", help=suppress_help)
19
22
  parser.add_argument(
20
23
  "--enable-dev",
21
24
  action="store_true",
22
- help=suppress_help or suppress_help or "Enable loading and running development versions of CWL",
25
+ help=suppress_help
26
+ or suppress_help
27
+ or "Enable loading and running development versions of CWL",
23
28
  )
24
29
  parser.add_argument(
25
30
  "--enable-ext",
26
31
  action="store_true",
27
- help=suppress_help or "Enable loading and running 'cwltool:' extensions to the CWL standards.",
32
+ help=suppress_help
33
+ or "Enable loading and running 'cwltool:' extensions to the CWL standards.",
28
34
  default=False,
29
35
  )
30
- parser.add_argument("--quiet", dest="quiet", action="store_true", default=False, help=suppress_help)
31
- parser.add_argument("--basedir", type=str, help=suppress_help) # TODO: Might be hard-coded?
36
+ parser.add_argument(
37
+ "--quiet", dest="quiet", action="store_true", default=False, help=suppress_help
38
+ )
39
+ parser.add_argument(
40
+ "--basedir", type=str, help=suppress_help
41
+ ) # TODO: Might be hard-coded?
32
42
  parser.add_argument("--outdir", type=str, default=None, help=suppress_help)
33
- parser.add_argument("--version", action="version", version=baseVersion,
34
- help=suppress_help or "show program's version number and exit")
43
+ parser.add_argument(
44
+ "--version",
45
+ action="version",
46
+ version=baseVersion,
47
+ help=suppress_help or "show program's version number and exit",
48
+ )
35
49
  parser.add_argument(
36
50
  "--log-dir",
37
51
  type=str,
38
52
  default="",
39
- help=suppress_help or "Log your tools stdout/stderr to this location outside of container",
53
+ help=suppress_help
54
+ or "Log your tools stdout/stderr to this location outside of container",
40
55
  )
41
56
  # this is as a result of suppressed help statements not working well with mutually_exclusive_groups, which will
42
57
  # cause an assertion error
43
58
  # https://github.com/python/cpython/issues/62090
44
- dockergroup = parser.add_mutually_exclusive_group() if not suppress_help else parser.add_argument_group()
59
+ dockergroup = (
60
+ parser.add_mutually_exclusive_group()
61
+ if not suppress_help
62
+ else parser.add_argument_group()
63
+ )
45
64
  dockergroup.add_argument(
46
65
  "--user-space-docker-cmd",
47
- help=suppress_help or "(Linux/OS X only) Specify a user space docker command (like "
48
- "udocker or dx-docker) that will be used to call 'pull' and 'run'",
66
+ help=suppress_help
67
+ or "(Linux/OS X only) Specify a user space docker command (like "
68
+ "udocker or dx-docker) that will be used to call 'pull' and 'run'",
49
69
  )
50
70
  dockergroup.add_argument(
51
71
  "--singularity",
52
72
  action="store_true",
53
73
  default=False,
54
- help=suppress_help or "Use Singularity runtime for running containers. "
55
- "Requires Singularity v2.6.1+ and Linux with kernel version v3.18+ or "
56
- "with overlayfs support backported.",
74
+ help=suppress_help
75
+ or "Use Singularity runtime for running containers. "
76
+ "Requires Singularity v2.6.1+ and Linux with kernel version v3.18+ or "
77
+ "with overlayfs support backported.",
57
78
  )
58
79
  dockergroup.add_argument(
59
80
  "--podman",
@@ -64,21 +85,23 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
64
85
  dockergroup.add_argument(
65
86
  "--no-container",
66
87
  action="store_true",
67
- help=suppress_help or "Do not execute jobs in a "
68
- "Docker container, even when `DockerRequirement` "
69
- "is specified under `hints`.",
88
+ help=suppress_help
89
+ or "Do not execute jobs in a "
90
+ "Docker container, even when `DockerRequirement` "
91
+ "is specified under `hints`.",
70
92
  )
71
93
  dockergroup.add_argument(
72
94
  "--leave-container",
73
95
  action="store_false",
74
96
  default=True,
75
- help=suppress_help or "Do not delete Docker container used by jobs after they exit",
97
+ help=suppress_help
98
+ or "Do not delete Docker container used by jobs after they exit",
76
99
  dest="rm_container",
77
100
  )
78
- extra_dockergroup = parser.add_argument_group()
79
- extra_dockergroup.add_argument(
101
+ parser.add_argument(
80
102
  "--custom-net",
81
- help=suppress_help or "Specify docker network name to pass to docker run command",
103
+ help=suppress_help
104
+ or "Specify docker network name to pass to docker run command",
82
105
  )
83
106
  cidgroup = parser.add_argument_group(
84
107
  "Options for recording the Docker container identifier into a file."
@@ -95,7 +118,8 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
95
118
  cidgroup.add_argument(
96
119
  "--cidfile-dir",
97
120
  type=str,
98
- help=suppress_help or "Store the Docker container ID into a file in the specified directory.",
121
+ help=suppress_help
122
+ or "Store the Docker container ID into a file in the specified directory.",
99
123
  default=None,
100
124
  dest="cidfile_dir",
101
125
  )
@@ -103,19 +127,28 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
103
127
  cidgroup.add_argument(
104
128
  "--cidfile-prefix",
105
129
  type=str,
106
- help=suppress_help or "Specify a prefix to the container ID filename. "
107
- "Final file name will be followed by a timestamp. "
108
- "The default is no prefix.",
130
+ help=suppress_help
131
+ or "Specify a prefix to the container ID filename. "
132
+ "Final file name will be followed by a timestamp. "
133
+ "The default is no prefix.",
109
134
  default=None,
110
135
  dest="cidfile_prefix",
111
136
  )
112
137
 
138
+ parser.add_argument(
139
+ "--no-prepull",
140
+ action="store_true",
141
+ default=False,
142
+ help=suppress_help
143
+ or "Do not prepull the container prior to running the workflow",
144
+ )
145
+
113
146
  parser.add_argument(
114
147
  "--preserve-environment",
115
148
  type=str,
116
149
  nargs="+",
117
- help=suppress_help or "Preserve specified environment variables when running"
118
- " CommandLineTools",
150
+ help=suppress_help
151
+ or "Preserve specified environment variables when running" " CommandLineTools",
119
152
  metavar=("VAR1 VAR2"),
120
153
  default=("PATH",),
121
154
  dest="preserve_environment",
@@ -123,19 +156,29 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
123
156
  parser.add_argument(
124
157
  "--preserve-entire-environment",
125
158
  action="store_true",
126
- help=suppress_help or "Preserve all environment variable when running CommandLineTools.",
159
+ help=suppress_help
160
+ or "Preserve all environment variable when running CommandLineTools.",
127
161
  default=False,
128
162
  dest="preserve_entire_environment",
129
163
  )
130
164
  parser.add_argument(
131
- "--destBucket",
132
- type=str,
133
- help=suppress_help or "Specify a cloud bucket endpoint for output files.",
165
+ "--beta-dependency-resolvers-configuration", default=None, help=suppress_help
166
+ )
167
+ parser.add_argument(
168
+ "--beta-dependencies-directory", default=None, help=suppress_help
169
+ )
170
+ parser.add_argument(
171
+ "--beta-use-biocontainers",
172
+ default=None,
173
+ action="store_true",
174
+ help=suppress_help,
175
+ )
176
+ parser.add_argument(
177
+ "--beta-conda-dependencies",
178
+ default=None,
179
+ action="store_true",
180
+ help=suppress_help,
134
181
  )
135
- parser.add_argument("--beta-dependency-resolvers-configuration", default=None, help=suppress_help)
136
- parser.add_argument("--beta-dependencies-directory", default=None, help=suppress_help)
137
- parser.add_argument("--beta-use-biocontainers", default=None, action="store_true", help=suppress_help)
138
- parser.add_argument("--beta-conda-dependencies", default=None, action="store_true", help=suppress_help)
139
182
  parser.add_argument(
140
183
  "--tmpdir-prefix",
141
184
  type=str,
@@ -170,32 +213,35 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
170
213
  parser.add_argument(
171
214
  "--strict-memory-limit",
172
215
  action="store_true",
173
- help=suppress_help or "When running with "
174
- "software containers and the Docker engine, pass either the "
175
- "calculated memory allocation from ResourceRequirements or the "
176
- "default of 1 gigabyte to Docker's --memory option.",
216
+ help=suppress_help
217
+ or "When running with "
218
+ "software containers and the Docker engine, pass either the "
219
+ "calculated memory allocation from ResourceRequirements or the "
220
+ "default of 1 gigabyte to Docker's --memory option.",
177
221
  )
178
222
  parser.add_argument(
179
223
  "--strict-cpu-limit",
180
224
  action="store_true",
181
- help=suppress_help or "When running with "
182
- "software containers and the Docker engine, pass either the "
183
- "calculated cpu allocation from ResourceRequirements or the "
184
- "default of 1 core to Docker's --cpu option. "
185
- "Requires docker version >= v1.13.",
225
+ help=suppress_help
226
+ or "When running with "
227
+ "software containers and the Docker engine, pass either the "
228
+ "calculated cpu allocation from ResourceRequirements or the "
229
+ "default of 1 core to Docker's --cpu option. "
230
+ "Requires docker version >= v1.13.",
186
231
  )
187
232
  parser.add_argument(
188
233
  "--relax-path-checks",
189
234
  action="store_true",
190
235
  default=False,
191
- help=suppress_help or "Relax requirements on path names to permit "
192
- "spaces and hash characters.",
236
+ help=suppress_help
237
+ or "Relax requirements on path names to permit " "spaces and hash characters.",
193
238
  dest="relax_path_checks",
194
239
  )
195
240
  parser.add_argument(
196
241
  "--default-container",
197
- help=suppress_help or "Specify a default docker container that will be "
198
- "used if the workflow fails to specify one.",
242
+ help=suppress_help
243
+ or "Specify a default docker container that will be "
244
+ "used if the workflow fails to specify one.",
199
245
  )
200
246
  parser.add_argument(
201
247
  "--disable-validate",
@@ -212,7 +258,11 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
212
258
  help=suppress_help or SUPPRESS,
213
259
  )
214
260
  # same workaround as dockergroup
215
- checkgroup = parser.add_mutually_exclusive_group() if not suppress_help else parser.add_argument_group()
261
+ checkgroup = (
262
+ parser.add_mutually_exclusive_group()
263
+ if not suppress_help
264
+ else parser.add_argument_group()
265
+ )
216
266
  checkgroup.add_argument(
217
267
  "--compute-checksum",
218
268
  action="store_true",
@@ -223,14 +273,16 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
223
273
  checkgroup.add_argument(
224
274
  "--no-compute-checksum",
225
275
  action="store_false",
226
- help=suppress_help or "Do not compute checksum of contents while collecting outputs",
276
+ help=suppress_help
277
+ or "Do not compute checksum of contents while collecting outputs",
227
278
  dest="compute_checksum",
228
279
  )
229
280
 
230
281
  parser.add_argument(
231
282
  "--eval-timeout",
232
- help=suppress_help or "Time to wait for a Javascript expression to evaluate before giving "
233
- "an error, default 20s.",
283
+ help=suppress_help
284
+ or "Time to wait for a Javascript expression to evaluate before giving "
285
+ "an error, default 20s.",
234
286
  type=float,
235
287
  default=20,
236
288
  )
@@ -245,34 +297,11 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
245
297
  "--mpi-config-file",
246
298
  type=str,
247
299
  default=None,
248
- help=suppress_help or "Platform specific configuration for MPI (parallel "
249
- "launcher, its flag etc). See the cwltool README "
250
- "section 'Running MPI-based tools' for details of the format: "
251
- "https://github.com/common-workflow-language/cwltool#running-mpi-based-tools-that-need-to-be-launched",
252
- )
253
- parser.add_argument(
254
- "--bypass-file-store",
255
- action="store_true",
256
- default=False,
257
- help=suppress_help or "Do not use Toil's file store and assume all "
258
- "paths are accessible in place from all nodes.",
259
- dest="bypass_file_store",
260
- )
261
- parser.add_argument(
262
- "--reference-inputs",
263
- action="store_true",
264
- default=False,
265
- help=suppress_help or "Do not copy remote inputs into Toil's file "
266
- "store and assume they are accessible in place from "
267
- "all nodes.",
268
- dest="reference_inputs",
269
- )
270
- parser.add_argument(
271
- "--disable-streaming",
272
- action="store_true",
273
- default=False,
274
- help=suppress_help or "Disable file streaming for files that have 'streamable' flag True",
275
- dest="disable_streaming",
300
+ help=suppress_help
301
+ or "Platform specific configuration for MPI (parallel "
302
+ "launcher, its flag etc). See the cwltool README "
303
+ "section 'Running MPI-based tools' for details of the format: "
304
+ "https://github.com/common-workflow-language/cwltool#running-mpi-based-tools-that-need-to-be-launched",
276
305
  )
277
306
 
278
307
  provgroup = parser.add_argument_group(
@@ -280,9 +309,10 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
280
309
  )
281
310
  provgroup.add_argument(
282
311
  "--provenance",
283
- help=suppress_help or "Save provenance to specified folder as a "
284
- "Research Object that captures and aggregates "
285
- "workflow execution and data products.",
312
+ help=suppress_help
313
+ or "Save provenance to specified folder as a "
314
+ "Research Object that captures and aggregates "
315
+ "workflow execution and data products.",
286
316
  type=str,
287
317
  )
288
318
 
@@ -316,21 +346,76 @@ def add_cwl_options(parser: ArgumentParser, suppress: bool = True) -> None:
316
346
  )
317
347
  provgroup.add_argument(
318
348
  "--orcid",
319
- help=suppress_help or "Record user ORCID identifier as part of "
320
- "provenance, e.g. https://orcid.org/0000-0002-1825-0097 "
321
- "or 0000-0002-1825-0097. Alternatively the environment variable "
322
- "ORCID may be set.",
349
+ help=suppress_help
350
+ or "Record user ORCID identifier as part of "
351
+ "provenance, e.g. https://orcid.org/0000-0002-1825-0097 "
352
+ "or 0000-0002-1825-0097. Alternatively the environment variable "
353
+ "ORCID may be set.",
323
354
  dest="orcid",
324
355
  default=os.environ.get("ORCID", ""),
325
356
  type=str,
326
357
  )
327
358
  provgroup.add_argument(
328
359
  "--full-name",
329
- help=suppress_help or "Record full name of user as part of provenance, "
330
- "e.g. Josiah Carberry. You may need to use shell quotes to preserve "
331
- "spaces. Alternatively the environment variable CWL_FULL_NAME may "
332
- "be set.",
360
+ help=suppress_help
361
+ or "Record full name of user as part of provenance, "
362
+ "e.g. Josiah Carberry. You may need to use shell quotes to preserve "
363
+ "spaces. Alternatively the environment variable CWL_FULL_NAME may "
364
+ "be set.",
333
365
  dest="cwl_full_name",
334
366
  default=os.environ.get("CWL_FULL_NAME", ""),
335
367
  type=str,
336
368
  )
369
+
370
+ # These are Toil-specific options
371
+ parser.add_argument(
372
+ "--bypass-file-store",
373
+ action="store_true",
374
+ default=False,
375
+ help=suppress_help
376
+ or "Do not use Toil's file store and assume all "
377
+ "paths are accessible in place from all nodes.",
378
+ dest="bypass_file_store",
379
+ )
380
+ parser.add_argument(
381
+ "--reference-inputs",
382
+ action="store_true",
383
+ default=False,
384
+ help=suppress_help
385
+ or "Do not copy remote inputs into Toil's file "
386
+ "store and assume they are accessible in place from "
387
+ "all nodes.",
388
+ dest="reference_inputs",
389
+ )
390
+ parser.add_argument(
391
+ "--disable-streaming",
392
+ action="store_true",
393
+ default=False,
394
+ help=suppress_help
395
+ or "Disable file streaming for files that have 'streamable' flag True.",
396
+ dest="disable_streaming",
397
+ )
398
+ ram_group = (
399
+ parser.add_mutually_exclusive_group()
400
+ if not suppress_help
401
+ else parser.add_argument_group()
402
+ )
403
+ ram_group.add_argument(
404
+ "--cwl-default-ram",
405
+ action="store_true",
406
+ default=True,
407
+ help=suppress_help or "Apply CWL specification default ramMin.",
408
+ dest="cwl_default_ram",
409
+ )
410
+ ram_group.add_argument(
411
+ "--no-cwl-default-ram",
412
+ action="store_false",
413
+ help=suppress_help
414
+ or "Do not apply CWL specification default ramMin, so that Toil --defaultMemory applies.",
415
+ dest="cwl_default_ram",
416
+ )
417
+ parser.add_argument(
418
+ "--destBucket",
419
+ type=str,
420
+ help=suppress_help or "Specify a cloud bucket endpoint for output files.",
421
+ )
toil/options/runner.py ADDED
@@ -0,0 +1,50 @@
1
+ from argparse import ArgumentParser
2
+
3
+ from toil.lib.conversions import human2bytes
4
+
5
+
6
+ def add_runner_options(
7
+ parser: ArgumentParser, cwl: bool = False, wdl: bool = False
8
+ ) -> None:
9
+ """
10
+ Add to the WDL or CWL runners options that are shared or the same between runners
11
+ :param parser: parser to add arguments to
12
+ :param cwl: bool
13
+ :param wdl: bool
14
+ :return: None
15
+ """
16
+ # This function should be constructed so that even when wdl and cwl are false, the "default" options are still added
17
+ run_imports_on_workers_arguments = ["--runImportsOnWorkers"]
18
+ if cwl:
19
+ run_imports_on_workers_arguments.append("--run-imports-on-workers")
20
+ parser.add_argument(
21
+ *run_imports_on_workers_arguments,
22
+ action="store_true",
23
+ default=False,
24
+ dest="run_imports_on_workers",
25
+ help="Run the file imports on a worker instead of the leader. This is useful if the leader is not optimized for high network performance. "
26
+ "If set to true, the argument --importWorkersDisk must also be set."
27
+ )
28
+ import_workers_threshold_argument = ["--importWorkersThreshold"]
29
+ if cwl:
30
+ import_workers_threshold_argument.append("--import-workers-threshold")
31
+ parser.add_argument(
32
+ *import_workers_threshold_argument,
33
+ dest="import_workers_threshold",
34
+ type=lambda x: human2bytes(str(x)),
35
+ default="1 GiB",
36
+ help="Specify the file size threshold that determines how many files go into a batched import. As many files will go into a batch import job until this threshold "
37
+ "is reached. This should be set in conjunction with the argument --runImportsOnWorkers."
38
+ )
39
+ import_workers_disk_argument = ["--importWorkersDisk"]
40
+ if cwl:
41
+ import_workers_disk_argument.append("--import-workers-disk")
42
+ parser.add_argument(
43
+ *import_workers_disk_argument,
44
+ dest="import_workers_disk",
45
+ type=lambda x: human2bytes(str(x)),
46
+ default="1 MiB",
47
+ help="Specify the disk size each import worker will get. This may be necessary when file streaming is not possible. For example, downloading from AWS to a GCE "
48
+ "job store. If specified, this should be set to the largest file size of all files to import. This should be set in conjunction with the arguments "
49
+ "--runImportsOnWorkers and --importWorkersThreshold."
50
+ )
toil/options/wdl.py CHANGED
@@ -2,6 +2,8 @@ from argparse import ArgumentParser
2
2
 
3
3
  from configargparse import SUPPRESS
4
4
 
5
+ from toil.lib.conversions import strtobool
6
+
5
7
 
6
8
  def add_wdl_options(parser: ArgumentParser, suppress: bool = True) -> None:
7
9
  """
@@ -13,20 +15,74 @@ def add_wdl_options(parser: ArgumentParser, suppress: bool = True) -> None:
13
15
  suppress_help = SUPPRESS if suppress else None
14
16
  # include arg names without a wdl specifier if suppress is False
15
17
  # this is to avoid possible duplicate options in custom toil scripts, ex outputFile can be a common argument name
16
- output_dialect_arguments = ["--wdlOutputDialect"] + (["--outputDialect"] if not suppress else [])
17
- parser.add_argument(*output_dialect_arguments, dest="output_dialect", type=str, default='cromwell',
18
- choices=['cromwell', 'miniwdl'],
19
- help=suppress_help or ("JSON output format dialect. 'cromwell' just returns the workflow's "
20
- "output values as JSON, while 'miniwdl' nests that under an 'outputs' "
21
- "key, and includes a 'dir' key where files are written."))
22
- output_directory_arguments = ["--wdlOutputDirectory"] + (["--outputDirectory", "-o"] if not suppress else [])
23
- parser.add_argument(*output_directory_arguments, dest="output_directory", type=str, default=None,
24
- help=suppress_help or (
25
- "Directory or URI prefix to save output files at. By default a new directory is created "
26
- "in the current directory."))
27
- output_file_arguments = ["--wdlOutputFile"] + (["--outputFile", "-m"] if not suppress else [])
28
- parser.add_argument(*output_file_arguments, dest="output_file", type=str, default=None,
29
- help=suppress_help or "File or URI to save output JSON to.")
30
- reference_inputs_arguments = ["--wdlReferenceInputs"] + (["--referenceInputs"] if not suppress else [])
31
- parser.add_argument(*reference_inputs_arguments, dest="reference_inputs", type=bool, default=False,
32
- help=suppress_help or "Pass input files by URL")
18
+ # TODO: Why do we even need them at all in other Toil scripts? Do we have to worry about dest= collisions?
19
+ # TODO: Can the better option name be first?
20
+ output_dialect_arguments = ["--wdlOutputDialect"] + (
21
+ ["--outputDialect"] if not suppress else []
22
+ )
23
+ parser.add_argument(
24
+ *output_dialect_arguments,
25
+ dest="output_dialect",
26
+ type=str,
27
+ default="cromwell",
28
+ choices=["cromwell", "miniwdl"],
29
+ help=suppress_help
30
+ or (
31
+ "JSON output format dialect. 'cromwell' just returns the workflow's "
32
+ "output values as JSON, while 'miniwdl' nests that under an 'outputs' "
33
+ "key, and includes a 'dir' key where files are written."
34
+ )
35
+ )
36
+ output_directory_arguments = ["--wdlOutputDirectory"] + (
37
+ ["--outputDirectory", "-o"] if not suppress else []
38
+ )
39
+ parser.add_argument(
40
+ *output_directory_arguments,
41
+ dest="output_directory",
42
+ type=str,
43
+ default=None,
44
+ help=suppress_help
45
+ or (
46
+ "Directory or URI prefix to save output files at. By default a new directory is created "
47
+ "in the current directory."
48
+ )
49
+ )
50
+ output_file_arguments = ["--wdlOutputFile"] + (
51
+ ["--outputFile", "-m"] if not suppress else []
52
+ )
53
+ parser.add_argument(
54
+ *output_file_arguments,
55
+ dest="output_file",
56
+ type=str,
57
+ default=None,
58
+ help=suppress_help or "File or URI to save output JSON to."
59
+ )
60
+ reference_inputs_arguments = ["--wdlReferenceInputs"] + (
61
+ ["--referenceInputs"] if not suppress else []
62
+ )
63
+ parser.add_argument(
64
+ *reference_inputs_arguments,
65
+ dest="reference_inputs",
66
+ type=strtobool,
67
+ default=False,
68
+ help=suppress_help or "Pass input files by URL"
69
+ )
70
+ container_arguments = ["--wdlContainer"] + (["--container"] if not suppress else [])
71
+ parser.add_argument(
72
+ *container_arguments,
73
+ dest="container",
74
+ type=str,
75
+ choices=["singularity", "docker", "auto"],
76
+ default="auto",
77
+ help=suppress_help or "Container engine to use to run WDL tasks"
78
+ )
79
+ all_call_outputs_arguments = ["--wdlAllCallOutputs"] + (
80
+ ["--allCallOutputs"] if not suppress else []
81
+ )
82
+ parser.add_argument(
83
+ *all_call_outputs_arguments,
84
+ dest="all_call_outputs",
85
+ type=strtobool,
86
+ default=None,
87
+ help=suppress_help or "Keep and return all call outputs as workflow outputs"
88
+ )