toil 5.12.0__py3-none-any.whl → 6.1.0a1__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 (157) hide show
  1. toil/__init__.py +18 -13
  2. toil/batchSystems/abstractBatchSystem.py +21 -10
  3. toil/batchSystems/abstractGridEngineBatchSystem.py +2 -2
  4. toil/batchSystems/awsBatch.py +14 -14
  5. toil/batchSystems/contained_executor.py +3 -3
  6. toil/batchSystems/htcondor.py +0 -1
  7. toil/batchSystems/kubernetes.py +34 -31
  8. toil/batchSystems/local_support.py +3 -1
  9. toil/batchSystems/mesos/batchSystem.py +7 -7
  10. toil/batchSystems/options.py +32 -83
  11. toil/batchSystems/registry.py +104 -23
  12. toil/batchSystems/singleMachine.py +16 -13
  13. toil/batchSystems/slurm.py +3 -3
  14. toil/batchSystems/torque.py +0 -1
  15. toil/bus.py +6 -8
  16. toil/common.py +532 -743
  17. toil/cwl/__init__.py +28 -32
  18. toil/cwl/cwltoil.py +523 -520
  19. toil/cwl/utils.py +55 -10
  20. toil/fileStores/__init__.py +2 -2
  21. toil/fileStores/abstractFileStore.py +36 -11
  22. toil/fileStores/cachingFileStore.py +607 -530
  23. toil/fileStores/nonCachingFileStore.py +43 -10
  24. toil/job.py +140 -75
  25. toil/jobStores/abstractJobStore.py +147 -79
  26. toil/jobStores/aws/jobStore.py +23 -9
  27. toil/jobStores/aws/utils.py +1 -2
  28. toil/jobStores/fileJobStore.py +117 -19
  29. toil/jobStores/googleJobStore.py +16 -7
  30. toil/jobStores/utils.py +5 -6
  31. toil/leader.py +71 -43
  32. toil/lib/accelerators.py +10 -5
  33. toil/lib/aws/__init__.py +3 -14
  34. toil/lib/aws/ami.py +22 -9
  35. toil/lib/aws/iam.py +21 -13
  36. toil/lib/aws/session.py +2 -16
  37. toil/lib/aws/utils.py +4 -5
  38. toil/lib/compatibility.py +1 -1
  39. toil/lib/conversions.py +7 -3
  40. toil/lib/docker.py +22 -23
  41. toil/lib/ec2.py +10 -6
  42. toil/lib/ec2nodes.py +106 -100
  43. toil/lib/encryption/_nacl.py +2 -1
  44. toil/lib/generatedEC2Lists.py +325 -18
  45. toil/lib/io.py +21 -0
  46. toil/lib/misc.py +1 -1
  47. toil/lib/resources.py +1 -1
  48. toil/lib/threading.py +74 -26
  49. toil/options/common.py +738 -0
  50. toil/options/cwl.py +336 -0
  51. toil/options/wdl.py +32 -0
  52. toil/provisioners/abstractProvisioner.py +1 -4
  53. toil/provisioners/aws/__init__.py +3 -6
  54. toil/provisioners/aws/awsProvisioner.py +6 -0
  55. toil/provisioners/clusterScaler.py +3 -2
  56. toil/provisioners/gceProvisioner.py +2 -2
  57. toil/realtimeLogger.py +2 -1
  58. toil/resource.py +24 -18
  59. toil/server/app.py +2 -3
  60. toil/server/cli/wes_cwl_runner.py +4 -4
  61. toil/server/utils.py +1 -1
  62. toil/server/wes/abstract_backend.py +3 -2
  63. toil/server/wes/amazon_wes_utils.py +5 -4
  64. toil/server/wes/tasks.py +2 -3
  65. toil/server/wes/toil_backend.py +2 -10
  66. toil/server/wsgi_app.py +2 -0
  67. toil/serviceManager.py +12 -10
  68. toil/statsAndLogging.py +5 -1
  69. toil/test/__init__.py +29 -54
  70. toil/test/batchSystems/batchSystemTest.py +11 -111
  71. toil/test/batchSystems/test_slurm.py +3 -2
  72. toil/test/cwl/cwlTest.py +213 -90
  73. toil/test/cwl/glob_dir.cwl +15 -0
  74. toil/test/cwl/preemptible.cwl +21 -0
  75. toil/test/cwl/preemptible_expression.cwl +28 -0
  76. toil/test/cwl/revsort.cwl +1 -1
  77. toil/test/cwl/revsort2.cwl +1 -1
  78. toil/test/docs/scriptsTest.py +0 -1
  79. toil/test/jobStores/jobStoreTest.py +27 -16
  80. toil/test/lib/aws/test_iam.py +4 -14
  81. toil/test/lib/aws/test_utils.py +0 -3
  82. toil/test/lib/dockerTest.py +4 -4
  83. toil/test/lib/test_ec2.py +11 -16
  84. toil/test/mesos/helloWorld.py +4 -5
  85. toil/test/mesos/stress.py +1 -1
  86. toil/test/provisioners/aws/awsProvisionerTest.py +9 -5
  87. toil/test/provisioners/clusterScalerTest.py +6 -4
  88. toil/test/provisioners/clusterTest.py +14 -3
  89. toil/test/provisioners/gceProvisionerTest.py +0 -6
  90. toil/test/provisioners/restartScript.py +3 -2
  91. toil/test/server/serverTest.py +1 -1
  92. toil/test/sort/restart_sort.py +2 -1
  93. toil/test/sort/sort.py +2 -1
  94. toil/test/sort/sortTest.py +2 -13
  95. toil/test/src/autoDeploymentTest.py +45 -45
  96. toil/test/src/busTest.py +5 -5
  97. toil/test/src/checkpointTest.py +2 -2
  98. toil/test/src/deferredFunctionTest.py +1 -1
  99. toil/test/src/fileStoreTest.py +32 -16
  100. toil/test/src/helloWorldTest.py +1 -1
  101. toil/test/src/importExportFileTest.py +1 -1
  102. toil/test/src/jobDescriptionTest.py +2 -1
  103. toil/test/src/jobServiceTest.py +1 -1
  104. toil/test/src/jobTest.py +18 -18
  105. toil/test/src/miscTests.py +5 -3
  106. toil/test/src/promisedRequirementTest.py +3 -3
  107. toil/test/src/realtimeLoggerTest.py +1 -1
  108. toil/test/src/resourceTest.py +2 -2
  109. toil/test/src/restartDAGTest.py +1 -1
  110. toil/test/src/resumabilityTest.py +36 -2
  111. toil/test/src/retainTempDirTest.py +1 -1
  112. toil/test/src/systemTest.py +2 -2
  113. toil/test/src/toilContextManagerTest.py +2 -2
  114. toil/test/src/userDefinedJobArgTypeTest.py +1 -1
  115. toil/test/utils/toilDebugTest.py +98 -32
  116. toil/test/utils/toilKillTest.py +2 -2
  117. toil/test/utils/utilsTest.py +20 -0
  118. toil/test/wdl/wdltoil_test.py +148 -45
  119. toil/toilState.py +7 -6
  120. toil/utils/toilClean.py +1 -1
  121. toil/utils/toilConfig.py +36 -0
  122. toil/utils/toilDebugFile.py +60 -33
  123. toil/utils/toilDebugJob.py +39 -12
  124. toil/utils/toilDestroyCluster.py +1 -1
  125. toil/utils/toilKill.py +1 -1
  126. toil/utils/toilLaunchCluster.py +13 -2
  127. toil/utils/toilMain.py +3 -2
  128. toil/utils/toilRsyncCluster.py +1 -1
  129. toil/utils/toilSshCluster.py +1 -1
  130. toil/utils/toilStats.py +240 -143
  131. toil/utils/toilStatus.py +1 -4
  132. toil/version.py +11 -11
  133. toil/wdl/utils.py +2 -122
  134. toil/wdl/wdltoil.py +999 -386
  135. toil/worker.py +25 -31
  136. {toil-5.12.0.dist-info → toil-6.1.0a1.dist-info}/METADATA +60 -53
  137. toil-6.1.0a1.dist-info/RECORD +237 -0
  138. {toil-5.12.0.dist-info → toil-6.1.0a1.dist-info}/WHEEL +1 -1
  139. {toil-5.12.0.dist-info → toil-6.1.0a1.dist-info}/entry_points.txt +0 -1
  140. toil/batchSystems/parasol.py +0 -379
  141. toil/batchSystems/tes.py +0 -459
  142. toil/test/batchSystems/parasolTestSupport.py +0 -117
  143. toil/test/wdl/builtinTest.py +0 -506
  144. toil/test/wdl/conftest.py +0 -23
  145. toil/test/wdl/toilwdlTest.py +0 -522
  146. toil/wdl/toilwdl.py +0 -141
  147. toil/wdl/versions/dev.py +0 -107
  148. toil/wdl/versions/draft2.py +0 -980
  149. toil/wdl/versions/v1.py +0 -794
  150. toil/wdl/wdl_analysis.py +0 -116
  151. toil/wdl/wdl_functions.py +0 -997
  152. toil/wdl/wdl_synthesis.py +0 -1011
  153. toil/wdl/wdl_types.py +0 -243
  154. toil-5.12.0.dist-info/RECORD +0 -244
  155. /toil/{wdl/versions → options}/__init__.py +0 -0
  156. {toil-5.12.0.dist-info → toil-6.1.0a1.dist-info}/LICENSE +0 -0
  157. {toil-5.12.0.dist-info → toil-6.1.0a1.dist-info}/top_level.txt +0 -0
toil/options/common.py ADDED
@@ -0,0 +1,738 @@
1
+ import os
2
+ from argparse import ArgumentParser, Action, _AppendAction
3
+ from typing import Any, Optional, Union, Type, Callable, List, Dict, TYPE_CHECKING
4
+
5
+ from distutils.util import strtobool
6
+ from configargparse import SUPPRESS
7
+ import logging
8
+
9
+ from ruamel.yaml import YAML
10
+
11
+ from toil.lib.conversions import bytes2human, human2bytes
12
+
13
+ from toil.batchSystems.options import add_all_batchsystem_options
14
+ from toil.provisioners import parse_node_types
15
+ from toil.statsAndLogging import add_logging_options
16
+ if TYPE_CHECKING:
17
+ from toil.job import AcceleratorRequirement
18
+
19
+ logger = logging.getLogger(__name__)
20
+
21
+ # aim to pack autoscaling jobs within a 30 minute block before provisioning a new node
22
+ defaultTargetTime = 1800
23
+ SYS_MAX_SIZE = 9223372036854775807
24
+ # sys.max_size on 64 bit systems is 9223372036854775807, so that 32-bit systems
25
+ # use the same number
26
+
27
+ def parse_set_env(l: List[str]) -> Dict[str, Optional[str]]:
28
+ """
29
+ Parse a list of strings of the form "NAME=VALUE" or just "NAME" into a dictionary.
30
+
31
+ Strings of the latter from will result in dictionary entries whose value is None.
32
+
33
+ >>> parse_set_env([])
34
+ {}
35
+ >>> parse_set_env(['a'])
36
+ {'a': None}
37
+ >>> parse_set_env(['a='])
38
+ {'a': ''}
39
+ >>> parse_set_env(['a=b'])
40
+ {'a': 'b'}
41
+ >>> parse_set_env(['a=a', 'a=b'])
42
+ {'a': 'b'}
43
+ >>> parse_set_env(['a=b', 'c=d'])
44
+ {'a': 'b', 'c': 'd'}
45
+ >>> parse_set_env(['a=b=c'])
46
+ {'a': 'b=c'}
47
+ >>> parse_set_env([''])
48
+ Traceback (most recent call last):
49
+ ...
50
+ ValueError: Empty name
51
+ >>> parse_set_env(['=1'])
52
+ Traceback (most recent call last):
53
+ ...
54
+ ValueError: Empty name
55
+ """
56
+ d = {}
57
+ v: Optional[str] = None
58
+ for i in l:
59
+ try:
60
+ k, v = i.split('=', 1)
61
+ except ValueError:
62
+ k, v = i, None
63
+ if not k:
64
+ raise ValueError('Empty name')
65
+ d[k] = v
66
+ return d
67
+
68
+
69
+ def parse_str_list(s: str) -> List[str]:
70
+ return [str(x) for x in s.split(",")]
71
+
72
+
73
+ def parse_int_list(s: str) -> List[int]:
74
+ return [int(x) for x in s.split(",")]
75
+
76
+
77
+ def iC(min_value: int, max_value: Optional[int] = None) -> Callable[[int], bool]:
78
+ """Returns a function that checks if a given int is in the given half-open interval."""
79
+ assert isinstance(min_value, int)
80
+ if max_value is None:
81
+ return lambda x: min_value <= x
82
+ assert isinstance(max_value, int)
83
+ return lambda x: min_value <= x < max_value
84
+
85
+
86
+ def fC(minValue: float, maxValue: Optional[float] = None) -> Callable[[float], bool]:
87
+ """Returns a function that checks if a given float is in the given half-open interval."""
88
+ assert isinstance(minValue, float)
89
+ if maxValue is None:
90
+ return lambda x: minValue <= x
91
+ assert isinstance(maxValue, float)
92
+ return lambda x: minValue <= x < maxValue
93
+
94
+
95
+ def parse_accelerator_list(specs: Optional[str]) -> List['AcceleratorRequirement']:
96
+ """
97
+ Parse a string description of one or more accelerator requirements.
98
+ """
99
+
100
+ if specs is None or len(specs) == 0:
101
+ # Not specified, so the default default is to not need any.
102
+ return []
103
+ # Otherwise parse each requirement.
104
+ from toil.job import parse_accelerator
105
+
106
+ return [parse_accelerator(r) for r in specs.split(',')]
107
+
108
+
109
+ def parseBool(val: str) -> bool:
110
+ if val.lower() in ['true', 't', 'yes', 'y', 'on', '1']:
111
+ return True
112
+ elif val.lower() in ['false', 'f', 'no', 'n', 'off', '0']:
113
+ return False
114
+ else:
115
+ raise RuntimeError("Could not interpret \"%s\" as a boolean value" % val)
116
+
117
+
118
+ # This is kept in the outer scope as multiple batchsystem files use this
119
+ def make_open_interval_action(min: Union[int, float], max: Optional[Union[int, float]] = None) -> Type[Action]:
120
+ """
121
+ Returns an argparse action class to check if the input is within the given half-open interval.
122
+ ex:
123
+ Provided value to argparse must be within the interval [min, max)
124
+ Types of min and max must be the same (max may be None)
125
+
126
+ :param min: float/int
127
+ :param max: optional float/int
128
+ :return: argparse action class
129
+ """
130
+
131
+ class IntOrFloatOpenAction(Action):
132
+ def __call__(self, parser: Any, namespace: Any, values: Any, option_string: Any = None) -> None:
133
+ if isinstance(min, int):
134
+ if max is not None: # for mypy
135
+ assert isinstance(max, int)
136
+ func = iC(min, max)
137
+ else:
138
+ func = fC(min, max)
139
+ try:
140
+ if not func(values):
141
+ raise parser.error(
142
+ f"{option_string} ({values}) must be within the range: [{min}, {'infinity' if max is None else max})")
143
+ except AssertionError:
144
+ raise RuntimeError(f"The {option_string} option has an invalid value: {values}")
145
+ setattr(namespace, self.dest, values)
146
+
147
+ return IntOrFloatOpenAction
148
+
149
+
150
+ def parse_jobstore(jobstore_uri: str) -> str:
151
+ """
152
+ Turn the jobstore string into it's corresponding URI
153
+ ex:
154
+ /path/to/jobstore -> file:/path/to/jobstore
155
+
156
+ If the jobstore string already is a URI, return the jobstore:
157
+ aws:/path/to/jobstore -> aws:/path/to/jobstore
158
+ :param jobstore_uri: string of the jobstore
159
+ :return: URI of the jobstore
160
+ """
161
+ from toil.common import Toil
162
+ name, rest = Toil.parseLocator(jobstore_uri)
163
+ if name == 'file':
164
+ # We need to resolve relative paths early, on the leader, because the worker process
165
+ # may have a different working directory than the leader, e.g. under Mesos.
166
+ return Toil.buildLocator(name, os.path.abspath(rest))
167
+ else:
168
+ return jobstore_uri
169
+
170
+
171
+ JOBSTORE_HELP = ("The location of the job store for the workflow. "
172
+ "A job store holds persistent information about the jobs, stats, and files in a "
173
+ "workflow. If the workflow is run with a distributed batch system, the job "
174
+ "store must be accessible by all worker nodes. Depending on the desired "
175
+ "job store implementation, the location should be formatted according to "
176
+ "one of the following schemes:\n\n"
177
+ "file:<path> where <path> points to a directory on the file systen\n\n"
178
+ "aws:<region>:<prefix> where <region> is the name of an AWS region like "
179
+ "us-west-2 and <prefix> will be prepended to the names of any top-level "
180
+ "AWS resources in use by job store, e.g. S3 buckets.\n\n "
181
+ "google:<project_id>:<prefix> TODO: explain\n\n"
182
+ "For backwards compatibility, you may also specify ./foo (equivalent to "
183
+ "file:./foo or just file:foo) or /bar (equivalent to file:/bar).")
184
+
185
+
186
+ def add_base_toil_options(parser: ArgumentParser, jobstore_as_flag: bool = False, cwl: bool = False) -> None:
187
+ """
188
+ Add base Toil command line options to the parser.
189
+ :param parser: Argument parser to add options to
190
+ :param jobstore_as_flag: make the job store option a --jobStore flag instead of a required jobStore positional argument.
191
+ :param cwl: whether CWL should be included or not
192
+ """
193
+
194
+ # This is necessary as the config file must have at least one valid key to parse properly and we want to use a
195
+ # dummy key
196
+ config = parser.add_argument_group()
197
+ config.add_argument("--config_version", default=None, help=SUPPRESS)
198
+
199
+ # If using argparse instead of configargparse, this should just not parse when calling parse_args()
200
+ # default config value is set to none as defaults should already be populated at config init
201
+ config.add_argument('--config', dest='config', is_config_file_arg=True, default=None, metavar="PATH",
202
+ help="Get options from a config file.")
203
+
204
+ def convert_bool(b: str) -> bool:
205
+ """Convert a string representation of bool to bool"""
206
+ return bool(strtobool(b))
207
+
208
+ def opt_strtobool(b: Optional[str]) -> Optional[bool]:
209
+ """Convert an optional string representation of bool to None or bool"""
210
+ return b if b is None else convert_bool(b)
211
+
212
+ add_logging_options(parser)
213
+ parser.register("type", "bool", parseBool) # Custom type for arg=True/False.
214
+
215
+ # Core options
216
+ core_options = parser.add_argument_group(
217
+ title="Toil core options.",
218
+ description="Options to specify the location of the Toil workflow and "
219
+ "turn on stats collation about the performance of jobs."
220
+ )
221
+ if jobstore_as_flag:
222
+ core_options.add_argument('--jobstore', '--jobStore', dest='jobStore', type=parse_jobstore, default=None,
223
+ help=JOBSTORE_HELP)
224
+ else:
225
+ core_options.add_argument('jobStore', type=parse_jobstore, help=JOBSTORE_HELP)
226
+
227
+ class WorkDirAction(Action):
228
+ """
229
+ Argparse action class to check that the provided --workDir exists
230
+ """
231
+
232
+ def __call__(self, parser: Any, namespace: Any, values: Any, option_string: Any = None) -> None:
233
+ workDir = values
234
+ if workDir is not None:
235
+ workDir = os.path.abspath(workDir)
236
+ if not os.path.exists(workDir):
237
+ raise RuntimeError(f"The path provided to --workDir ({workDir}) does not exist.")
238
+
239
+ if len(workDir) > 80:
240
+ logger.warning(f'Length of workDir path "{workDir}" is {len(workDir)} characters. '
241
+ f'Consider setting a shorter path with --workPath or setting TMPDIR to something '
242
+ f'like "/tmp" to avoid overly long paths.')
243
+ setattr(namespace, self.dest, workDir)
244
+
245
+ class CoordinationDirAction(Action):
246
+ """
247
+ Argparse action class to check that the provided --coordinationDir exists
248
+ """
249
+
250
+ def __call__(self, parser: Any, namespace: Any, values: Any, option_string: Any = None) -> None:
251
+ coordination_dir = values
252
+ if coordination_dir is not None:
253
+ coordination_dir = os.path.abspath(coordination_dir)
254
+ if not os.path.exists(coordination_dir):
255
+ raise RuntimeError(
256
+ f"The path provided to --coordinationDir ({coordination_dir}) does not exist.")
257
+ setattr(namespace, self.dest, coordination_dir)
258
+
259
+ def make_closed_interval_action(min: Union[int, float], max: Optional[Union[int, float]] = None) -> Type[Action]:
260
+ """
261
+ Returns an argparse action class to check if the input is within the given half-open interval.
262
+ ex:
263
+ Provided value to argparse must be within the interval [min, max]
264
+
265
+ :param min: int/float
266
+ :param max: optional int/float
267
+ :return: argparse action
268
+ """
269
+
270
+ class ClosedIntOrFloatAction(Action):
271
+ def __call__(self, parser: Any, namespace: Any, values: Any, option_string: Any = None) -> None:
272
+ def is_within(x: Union[int, float]) -> bool:
273
+ if max is None:
274
+ return min <= x
275
+ else:
276
+ return min <= x <= max
277
+
278
+ try:
279
+ if not is_within(values):
280
+ raise parser.error(
281
+ f"{option_string} ({values}) must be within the range: [{min}, {'infinity' if max is None else max}]")
282
+ except AssertionError:
283
+ raise RuntimeError(f"The {option_string} option has an invalid value: {values}")
284
+ setattr(namespace, self.dest, values)
285
+
286
+ return ClosedIntOrFloatAction
287
+
288
+ core_options.add_argument("--workDir", dest="workDir", default=None, env_var="TOIL_WORKDIR", action=WorkDirAction,
289
+ metavar="PATH",
290
+ help="Absolute path to directory where temporary files generated during the Toil "
291
+ "run should be placed. Standard output and error from batch system jobs "
292
+ "(unless --noStdOutErr is set) will be placed in this directory. A cache directory "
293
+ "may be placed in this directory. Temp files and folders will be placed in a "
294
+ "directory toil-<workflowID> within workDir. The workflowID is generated by "
295
+ "Toil and will be reported in the workflow logs. Default is determined by the "
296
+ "variables (TMPDIR, TEMP, TMP) via mkdtemp. This directory needs to exist on "
297
+ "all machines running jobs; if capturing standard output and error from batch "
298
+ "system jobs is desired, it will generally need to be on a shared file system. "
299
+ "When sharing a cache between containers on a host, this directory must be "
300
+ "shared between the containers.")
301
+ core_options.add_argument("--coordinationDir", dest="coordination_dir", default=None,
302
+ env_var="TOIL_COORDINATION_DIR", action=CoordinationDirAction, metavar="PATH",
303
+ help="Absolute path to directory where Toil will keep state and lock files."
304
+ "When sharing a cache between containers on a host, this directory must be "
305
+ "shared between the containers.")
306
+ core_options.add_argument("--noStdOutErr", dest="noStdOutErr", default=False, action="store_true",
307
+ help="Do not capture standard output and error from batch system jobs.")
308
+ core_options.add_argument("--stats", dest="stats", default=False, action="store_true",
309
+ help="Records statistics about the toil workflow to be used by 'toil stats'.")
310
+ clean_choices = ['always', 'onError', 'never', 'onSuccess']
311
+ core_options.add_argument("--clean", dest="clean", choices=clean_choices, default="onSuccess",
312
+ help=f"Determines the deletion of the jobStore upon completion of the program. "
313
+ f"Choices: {clean_choices}. The --stats option requires information from the "
314
+ f"jobStore upon completion so the jobStore will never be deleted with that flag. "
315
+ f"If you wish to be able to restart the run, choose \'never\' or \'onSuccess\'. "
316
+ f"Default is \'never\' if stats is enabled, and \'onSuccess\' otherwise.")
317
+ core_options.add_argument("--cleanWorkDir", dest="cleanWorkDir", choices=clean_choices, default='always',
318
+ help=f"Determines deletion of temporary worker directory upon completion of a job. "
319
+ f"Choices: {clean_choices}. Default = always. WARNING: This option should be "
320
+ f"changed for debugging only. Running a full pipeline with this option could "
321
+ f"fill your disk with excessive intermediate data.")
322
+ core_options.add_argument("--clusterStats", dest="clusterStats", nargs='?', action='store', default=None,
323
+ metavar="OPT_PATH", const=os.getcwd(),
324
+ help="If enabled, writes out JSON resource usage statistics to a file. "
325
+ "The default location for this file is the current working directory, but an "
326
+ "absolute path can also be passed to specify where this file should be written. "
327
+ "This options only applies when using scalable batch systems.")
328
+
329
+ # Restarting the workflow options
330
+ restart_options = parser.add_argument_group(
331
+ title="Toil options for restarting an existing workflow.",
332
+ description="Allows the restart of an existing workflow"
333
+ )
334
+ restart_options.add_argument("--restart", dest="restart", default=False, action="store_true",
335
+ help="If --restart is specified then will attempt to restart existing workflow "
336
+ "at the location pointed to by the --jobStore option. Will raise an exception "
337
+ "if the workflow does not exist")
338
+
339
+ # Batch system options
340
+ batchsystem_options = parser.add_argument_group(
341
+ title="Toil options for specifying the batch system.",
342
+ description="Allows the specification of the batch system."
343
+ )
344
+ add_all_batchsystem_options(batchsystem_options)
345
+
346
+ # File store options
347
+ file_store_options = parser.add_argument_group(
348
+ title="Toil options for configuring storage.",
349
+ description="Allows configuring Toil's data storage."
350
+ )
351
+ link_imports = file_store_options.add_mutually_exclusive_group()
352
+ link_imports_help = ("When using a filesystem based job store, CWL input files are by default symlinked in. "
353
+ "Setting this option to True instead copies the files into the job store, which may protect "
354
+ "them from being modified externally. When set to False, as long as caching is enabled, "
355
+ "Toil will protect the file automatically by changing the permissions to read-only."
356
+ "default=%(default)s")
357
+ link_imports.add_argument("--symlinkImports", dest="symlinkImports", type=convert_bool, default=True,
358
+ metavar="BOOL", help=link_imports_help)
359
+ move_exports = file_store_options.add_mutually_exclusive_group()
360
+ move_exports_help = ('When using a filesystem based job store, output files are by default moved to the '
361
+ 'output directory, and a symlink to the moved exported file is created at the initial '
362
+ 'location. Setting this option to True instead copies the files into the output directory. '
363
+ 'Applies to filesystem-based job stores only.'
364
+ 'default=%(default)s')
365
+ move_exports.add_argument("--moveOutputs", dest="moveOutputs", type=convert_bool, default=False, metavar="BOOL",
366
+ help=move_exports_help)
367
+
368
+ caching = file_store_options.add_mutually_exclusive_group()
369
+ caching_help = "Enable or disable caching for your workflow, specifying this overrides default from job store"
370
+ caching.add_argument('--caching', dest='caching', type=opt_strtobool, default=None, metavar="BOOL",
371
+ help=caching_help)
372
+ # default is None according to PR 4299, seems to be generated at runtime
373
+
374
+ # Auto scaling options
375
+ autoscaling_options = parser.add_argument_group(
376
+ title="Toil options for autoscaling the cluster of worker nodes.",
377
+ description="Allows the specification of the minimum and maximum number of nodes in an autoscaled cluster, "
378
+ "as well as parameters to control the level of provisioning."
379
+ )
380
+ provisioner_choices = ['aws', 'gce', None]
381
+
382
+ # TODO: Better consolidate this provisioner arg and the one in provisioners/__init__.py?
383
+ autoscaling_options.add_argument('--provisioner', '-p', dest="provisioner", choices=provisioner_choices,
384
+ default=None,
385
+ help=f"The provisioner for cluster auto-scaling. This is the main Toil "
386
+ f"'--provisioner' option, and defaults to None for running on single "
387
+ f"machine and non-auto-scaling batch systems. The currently supported "
388
+ f"choices are {provisioner_choices}. The default is %(default)s.")
389
+ autoscaling_options.add_argument('--nodeTypes', default=[], dest="nodeTypes", type=parse_node_types,
390
+ action="extend",
391
+ help="Specifies a list of comma-separated node types, each of which is "
392
+ "composed of slash-separated instance types, and an optional spot "
393
+ "bid set off by a colon, making the node type preemptible. Instance "
394
+ "types may appear in multiple node types, and the same node type "
395
+ "may appear as both preemptible and non-preemptible.\n"
396
+ "Valid argument specifying two node types:\n"
397
+ "\tc5.4xlarge/c5a.4xlarge:0.42,t2.large\n"
398
+ "Node types:\n"
399
+ "\tc5.4xlarge/c5a.4xlarge:0.42 and t2.large\n"
400
+ "Instance types:\n"
401
+ "\tc5.4xlarge, c5a.4xlarge, and t2.large\n"
402
+ "Semantics:\n"
403
+ "\tBid $0.42/hour for either c5.4xlarge or c5a.4xlarge instances,\n"
404
+ "\ttreated interchangeably, while they are available at that price,\n"
405
+ "\tand buy t2.large instances at full price.\n"
406
+ "default=%(default)s")
407
+
408
+ class NodeExtendAction(_AppendAction):
409
+ """
410
+ argparse Action class to remove the default value on first call, and act as an extend action after
411
+ """
412
+
413
+ # with action=append/extend, the argparse default is always prepended to the option
414
+ # so make the CLI have priority by rewriting the option on the first run
415
+ def __init__(self, option_strings: Any, dest: Any, **kwargs: Any):
416
+ super().__init__(option_strings, dest, **kwargs)
417
+ self.is_default = True
418
+
419
+ def __call__(self, parser: Any, namespace: Any, values: Any, option_string: Any = None) -> None:
420
+ if self.is_default:
421
+ setattr(namespace, self.dest, values)
422
+ self.is_default = False
423
+ else:
424
+ super().__call__(parser, namespace, values, option_string)
425
+
426
+ autoscaling_options.add_argument('--maxNodes', default=[10], dest="maxNodes", type=parse_int_list,
427
+ action=NodeExtendAction, metavar="INT[,INT...]",
428
+ help=f"Maximum number of nodes of each type in the cluster, if using autoscaling, "
429
+ f"provided as a comma-separated list. The first value is used as a default "
430
+ f"if the list length is less than the number of nodeTypes. "
431
+ f"default=%(default)s")
432
+ autoscaling_options.add_argument('--minNodes', default=[0], dest="minNodes", type=parse_int_list,
433
+ action=NodeExtendAction, metavar="INT[,INT...]",
434
+ help="Mininum number of nodes of each type in the cluster, if using "
435
+ "auto-scaling. This should be provided as a comma-separated list of the "
436
+ "same length as the list of node types. default=%(default)s")
437
+ autoscaling_options.add_argument("--targetTime", dest="targetTime", default=defaultTargetTime, type=int,
438
+ action=make_closed_interval_action(0), metavar="INT",
439
+ help=f"Sets how rapidly you aim to complete jobs in seconds. Shorter times mean "
440
+ f"more aggressive parallelization. The autoscaler attempts to scale up/down "
441
+ f"so that it expects all queued jobs will complete within targetTime "
442
+ f"seconds. default=%(default)s")
443
+ autoscaling_options.add_argument("--betaInertia", dest="betaInertia", default=0.1, type=float,
444
+ action=make_closed_interval_action(0.0, 0.9), metavar="FLOAT",
445
+ help=f"A smoothing parameter to prevent unnecessary oscillations in the number "
446
+ f"of provisioned nodes. This controls an exponentially weighted moving "
447
+ f"average of the estimated number of nodes. A value of 0.0 disables any "
448
+ f"smoothing, and a value of 0.9 will smooth so much that few changes will "
449
+ f"ever be made. Must be between 0.0 and 0.9. default=%(default)s")
450
+ autoscaling_options.add_argument("--scaleInterval", dest="scaleInterval", default=60, type=int, metavar="INT",
451
+ help=f"The interval (seconds) between assessing if the scale of "
452
+ f"the cluster needs to change. default=%(default)s")
453
+ autoscaling_options.add_argument("--preemptibleCompensation", "--preemptableCompensation",
454
+ dest="preemptibleCompensation", default=0.0, type=float,
455
+ action=make_closed_interval_action(0.0, 1.0), metavar="FLOAT",
456
+ help=f"The preference of the autoscaler to replace preemptible nodes with "
457
+ f"non-preemptible nodes, when preemptible nodes cannot be started for some "
458
+ f"reason. This value must be between 0.0 and 1.0, inclusive. "
459
+ f"A value of 0.0 disables such "
460
+ f"compensation, a value of 0.5 compensates two missing preemptible nodes "
461
+ f"with a non-preemptible one. A value of 1.0 replaces every missing "
462
+ f"pre-emptable node with a non-preemptible one. default=%(default)s")
463
+ autoscaling_options.add_argument("--nodeStorage", dest="nodeStorage", default=50, type=int, metavar="INT",
464
+ help="Specify the size of the root volume of worker nodes when they are launched "
465
+ "in gigabytes. You may want to set this if your jobs require a lot of disk "
466
+ f"space. (default=%(default)s).")
467
+ autoscaling_options.add_argument('--nodeStorageOverrides', dest="nodeStorageOverrides", default=[],
468
+ type=parse_str_list, action="extend",
469
+ metavar="NODETYPE:NODESTORAGE[,NODETYPE:NODESTORAGE...]",
470
+ help="Comma-separated list of nodeType:nodeStorage that are used to override "
471
+ "the default value from --nodeStorage for the specified nodeType(s). "
472
+ "This is useful for heterogeneous jobs where some tasks require much more "
473
+ "disk than others.")
474
+
475
+ autoscaling_options.add_argument("--metrics", dest="metrics", default=False, type=convert_bool, metavar="BOOL",
476
+ help="Enable the prometheus/grafana dashboard for monitoring CPU/RAM usage, "
477
+ "queue size, and issued jobs.")
478
+ autoscaling_options.add_argument("--assumeZeroOverhead", dest="assume_zero_overhead", default=False,
479
+ type=convert_bool, metavar="BOOL",
480
+ help="Ignore scheduler and OS overhead and assume jobs can use every last byte "
481
+ "of memory and disk on a node when autoscaling.")
482
+
483
+ # Parameters to limit service jobs / detect service deadlocks
484
+ service_options = parser.add_argument_group(
485
+ title="Toil options for limiting the number of service jobs and detecting service deadlocks",
486
+ description="Allows the specification of the maximum number of service jobs in a cluster. By keeping "
487
+ "this limited we can avoid nodes occupied with services causing deadlocks."
488
+ )
489
+ service_options.add_argument("--maxServiceJobs", dest="maxServiceJobs", default=SYS_MAX_SIZE, type=int,
490
+ metavar="INT",
491
+ help=SUPPRESS if cwl else f"The maximum number of service jobs that can be run "
492
+ f"concurrently, excluding service jobs running on "
493
+ f"preemptible nodes. default=%(default)s")
494
+ service_options.add_argument("--maxPreemptibleServiceJobs", dest="maxPreemptibleServiceJobs",
495
+ default=SYS_MAX_SIZE,
496
+ type=int, metavar="INT",
497
+ help=SUPPRESS if cwl else "The maximum number of service jobs that can run "
498
+ "concurrently on preemptible nodes. default=%(default)s")
499
+ service_options.add_argument("--deadlockWait", dest="deadlockWait", default=60, type=int, metavar="INT",
500
+ help=SUPPRESS if cwl else f"Time, in seconds, to tolerate the workflow running only "
501
+ f"the same service jobs, with no jobs to use them, "
502
+ f"before declaring the workflow to be deadlocked and "
503
+ f"stopping. default=%(default)s")
504
+ service_options.add_argument("--deadlockCheckInterval", dest="deadlockCheckInterval", default=30, type=int,
505
+ metavar="INT",
506
+ help=SUPPRESS if cwl else "Time, in seconds, to wait between checks to see if the "
507
+ "workflow is stuck running only service jobs, with no jobs "
508
+ "to use them. Should be shorter than --deadlockWait. May "
509
+ "need to be increased if the batch system cannot enumerate "
510
+ "running jobs quickly enough, or if polling for running "
511
+ "jobs is placing an unacceptable load on a shared cluster."
512
+ f"default=%(default)s")
513
+
514
+ # Resource requirements
515
+ resource_options = parser.add_argument_group(
516
+ title="Toil options for cores/memory requirements.",
517
+ description="The options to specify default cores/memory requirements (if not specified by the jobs "
518
+ "themselves), and to limit the total amount of memory/cores requested from the batch system."
519
+ )
520
+ resource_help_msg = ('The {} amount of {} to request for a job. '
521
+ 'Only applicable to jobs that do not specify an explicit value for this requirement. '
522
+ '{}. '
523
+ 'Default is {}.')
524
+ cpu_note = 'Fractions of a core (for example 0.1) are supported on some batch systems [mesos, single_machine]'
525
+ disk_mem_note = 'Standard suffixes like K, Ki, M, Mi, G or Gi are supported'
526
+ accelerators_note = (
527
+ 'Each accelerator specification can have a type (gpu [default], nvidia, amd, cuda, rocm, opencl, '
528
+ 'or a specific model like nvidia-tesla-k80), and a count [default: 1]. If both a type and a count '
529
+ 'are used, they must be separated by a colon. If multiple types of accelerators are '
530
+ 'used, the specifications are separated by commas')
531
+
532
+ h2b = lambda x: human2bytes(str(x))
533
+
534
+ resource_options.add_argument('--defaultMemory', dest='defaultMemory', default="2.0 Gi", type=h2b,
535
+ action=make_open_interval_action(1),
536
+ help=resource_help_msg.format('default', 'memory', disk_mem_note,
537
+ bytes2human(2147483648)))
538
+ resource_options.add_argument('--defaultCores', dest='defaultCores', default=1, metavar='FLOAT', type=float,
539
+ action=make_open_interval_action(1.0),
540
+ help=resource_help_msg.format('default', 'cpu', cpu_note, str(1)))
541
+ resource_options.add_argument('--defaultDisk', dest='defaultDisk', default="2.0 Gi", metavar='INT', type=h2b,
542
+ action=make_open_interval_action(1),
543
+ help=resource_help_msg.format('default', 'disk', disk_mem_note,
544
+ bytes2human(2147483648)))
545
+ resource_options.add_argument('--defaultAccelerators', dest='defaultAccelerators', default=[],
546
+ metavar='ACCELERATOR[,ACCELERATOR...]', type=parse_accelerator_list, action="extend",
547
+ help=resource_help_msg.format('default', 'accelerators', accelerators_note, []))
548
+ resource_options.add_argument('--defaultPreemptible', '--defaultPreemptable', dest='defaultPreemptible',
549
+ metavar='BOOL',
550
+ type=convert_bool, nargs='?', const=True, default=False,
551
+ help='Make all jobs able to run on preemptible (spot) nodes by default.')
552
+ resource_options.add_argument('--maxCores', dest='maxCores', default=SYS_MAX_SIZE, metavar='INT', type=int,
553
+ action=make_open_interval_action(1),
554
+ help=resource_help_msg.format('max', 'cpu', cpu_note, str(SYS_MAX_SIZE)))
555
+ resource_options.add_argument('--maxMemory', dest='maxMemory', default=SYS_MAX_SIZE, metavar='INT', type=h2b,
556
+ action=make_open_interval_action(1),
557
+ help=resource_help_msg.format('max', 'memory', disk_mem_note,
558
+ bytes2human(SYS_MAX_SIZE)))
559
+ resource_options.add_argument('--maxDisk', dest='maxDisk', default=SYS_MAX_SIZE, metavar='INT', type=h2b,
560
+ action=make_open_interval_action(1),
561
+ help=resource_help_msg.format('max', 'disk', disk_mem_note,
562
+ bytes2human(SYS_MAX_SIZE)))
563
+
564
+ # Retrying/rescuing jobs
565
+ job_options = parser.add_argument_group(
566
+ title="Toil options for rescuing/killing/restarting jobs.",
567
+ description="The options for jobs that either run too long/fail or get lost (some batch systems have issues!)."
568
+ )
569
+ job_options.add_argument("--retryCount", dest="retryCount", default=1, type=int,
570
+ action=make_open_interval_action(0), metavar="INT",
571
+ help=f"Number of times to retry a failing job before giving up and "
572
+ f"labeling job failed. default={1}")
573
+ job_options.add_argument("--enableUnlimitedPreemptibleRetries", "--enableUnlimitedPreemptableRetries",
574
+ dest="enableUnlimitedPreemptibleRetries",
575
+ type=convert_bool, default=False, metavar="BOOL",
576
+ help="If set, preemptible failures (or any failure due to an instance getting "
577
+ "unexpectedly terminated) will not count towards job failures and --retryCount.")
578
+ job_options.add_argument("--doubleMem", dest="doubleMem", type=convert_bool, default=False, metavar="BOOL",
579
+ help="If set, batch jobs which die to reaching memory limit on batch schedulers "
580
+ "will have their memory doubled and they will be retried. The remaining "
581
+ "retry count will be reduced by 1. Currently supported by LSF.")
582
+ job_options.add_argument("--maxJobDuration", dest="maxJobDuration", default=SYS_MAX_SIZE, type=int,
583
+ action=make_open_interval_action(1), metavar="INT",
584
+ help=f"Maximum runtime of a job (in seconds) before we kill it (this is a lower bound, "
585
+ f"and the actual time before killing the job may be longer). "
586
+ f"default=%(default)s")
587
+ job_options.add_argument("--rescueJobsFrequency", dest="rescueJobsFrequency", default=60, type=int,
588
+ action=make_open_interval_action(1), metavar="INT",
589
+ help=f"Period of time to wait (in seconds) between checking for missing/overlong jobs, "
590
+ f"that is jobs which get lost by the batch system. Expert parameter. "
591
+ f"default=%(default)s")
592
+
593
+ # Log management options
594
+ log_options = parser.add_argument_group(
595
+ title="Toil log management options.",
596
+ description="Options for how Toil should manage its logs."
597
+ )
598
+ log_options.add_argument("--maxLogFileSize", dest="maxLogFileSize", default=64000, type=h2b,
599
+ action=make_open_interval_action(1),
600
+ help=f"The maximum size of a job log file to keep (in bytes), log files larger than "
601
+ f"this will be truncated to the last X bytes. Setting this option to zero will "
602
+ f"prevent any truncation. Setting this option to a negative value will truncate "
603
+ f"from the beginning. Default={bytes2human(64000)}")
604
+ log_options.add_argument("--writeLogs", dest="writeLogs", nargs='?', action='store', default=None,
605
+ const=os.getcwd(), metavar="OPT_PATH",
606
+ help="Write worker logs received by the leader into their own files at the specified "
607
+ "path. Any non-empty standard output and error from failed batch system jobs will "
608
+ "also be written into files at this path. The current working directory will be "
609
+ "used if a path is not specified explicitly. Note: By default only the logs of "
610
+ "failed jobs are returned to leader. Set log level to 'debug' or enable "
611
+ "'--writeLogsFromAllJobs' to get logs back from successful jobs, and adjust "
612
+ "'maxLogFileSize' to control the truncation limit for worker logs.")
613
+ log_options.add_argument("--writeLogsGzip", dest="writeLogsGzip", nargs='?', action='store', default=None,
614
+ const=os.getcwd(), metavar="OPT_PATH",
615
+ help="Identical to --writeLogs except the logs files are gzipped on the leader.")
616
+ log_options.add_argument("--writeLogsFromAllJobs", dest="writeLogsFromAllJobs", type=convert_bool,
617
+ default=False, metavar="BOOL",
618
+ help="Whether to write logs from all jobs (including the successful ones) without "
619
+ "necessarily setting the log level to 'debug'. Ensure that either --writeLogs "
620
+ "or --writeLogsGzip is set if enabling this option.")
621
+ log_options.add_argument("--writeMessages", dest="write_messages", default=None,
622
+ type=lambda x: None if x is None else os.path.abspath(x), metavar="PATH",
623
+ help="File to send messages from the leader's message bus to.")
624
+ log_options.add_argument("--realTimeLogging", dest="realTimeLogging", type=convert_bool, default=False,
625
+ help="Enable real-time logging from workers to leader")
626
+
627
+ # Misc options
628
+ misc_options = parser.add_argument_group(
629
+ title="Toil miscellaneous options.",
630
+ description="Everything else."
631
+ )
632
+ misc_options.add_argument('--disableChaining', dest='disableChaining', type=convert_bool, default=False,
633
+ metavar="BOOL",
634
+ help="Disables chaining of jobs (chaining uses one job's resource allocation "
635
+ "for its successor job if possible).")
636
+ misc_options.add_argument("--disableJobStoreChecksumVerification", dest="disableJobStoreChecksumVerification",
637
+ default=False, type=convert_bool, metavar="BOOL",
638
+ help="Disables checksum verification for files transferred to/from the job store. "
639
+ "Checksum verification is a safety check to ensure the data is not corrupted "
640
+ "during transfer. Currently only supported for non-streaming AWS files.")
641
+
642
+ class SSEKeyAction(Action):
643
+ def __call__(self, parser: Any, namespace: Any, values: Any, option_string: Any = None) -> None:
644
+ if values is not None:
645
+ sse_key = values
646
+ if sse_key is None:
647
+ return
648
+ with open(sse_key) as f:
649
+ assert len(f.readline().rstrip()) == 32, 'SSE key appears to be invalid.'
650
+ setattr(namespace, self.dest, values)
651
+
652
+ misc_options.add_argument("--sseKey", dest="sseKey", default=None, action=SSEKeyAction, metavar="PATH",
653
+ help="Path to file containing 32 character key to be used for server-side encryption on "
654
+ "awsJobStore or googleJobStore. SSE will not be used if this flag is not passed.")
655
+
656
+ # yaml.safe_load is being deprecated, this is the suggested workaround
657
+ def yaml_safe_load(stream: Any) -> Any:
658
+ yaml = YAML(typ='safe', pure=True)
659
+ d = yaml.load(stream)
660
+ if isinstance(d, dict):
661
+ # this means the argument was a dictionary and is valid yaml (for configargparse)
662
+ return d
663
+ else:
664
+ # this means the argument is likely in it's string format (for CLI)
665
+ return parse_set_env(parse_str_list(stream))
666
+
667
+ class ExtendActionDict(Action):
668
+ """
669
+ Argparse action class to implement the action="extend" functionality on dictionaries
670
+ """
671
+
672
+ def __call__(self, parser: Any, namespace: Any, values: Any, option_string: Any = None) -> None:
673
+ items = getattr(namespace, self.dest, None)
674
+ assert items is not None # for mypy. This should never be None, esp. if called in setEnv
675
+ # note: this will overwrite existing entries
676
+ items.update(values)
677
+
678
+ misc_options.add_argument("--setEnv", '-e', metavar='NAME=VALUE or NAME', dest="environment",
679
+ default={}, type=yaml_safe_load, action=ExtendActionDict,
680
+ help="Set an environment variable early on in the worker. If VALUE is null, it will "
681
+ "be looked up in the current environment. Independently of this option, the worker "
682
+ "will try to emulate the leader's environment before running a job, except for "
683
+ "some variables known to vary across systems. Using this option, a variable can "
684
+ "be injected into the worker process itself before it is started.")
685
+ misc_options.add_argument("--servicePollingInterval", dest="servicePollingInterval", default=60.0, type=float,
686
+ action=make_open_interval_action(0.0), metavar="FLOAT",
687
+ help=f"Interval of time service jobs wait between polling for the existence of the "
688
+ f"keep-alive flag. Default: {60.0}")
689
+ misc_options.add_argument('--forceDockerAppliance', dest='forceDockerAppliance', type=convert_bool, default=False,
690
+ metavar="BOOL",
691
+ help='Disables sanity checking the existence of the docker image specified by '
692
+ 'TOIL_APPLIANCE_SELF, which Toil uses to provision mesos for autoscaling.')
693
+ misc_options.add_argument('--statusWait', dest='statusWait', type=int, default=3600, metavar="INT",
694
+ help="Seconds to wait between reports of running jobs.")
695
+ misc_options.add_argument('--disableProgress', dest='disableProgress', type=convert_bool, default=False,
696
+ metavar="BOOL",
697
+ help="Disables the progress bar shown when standard error is a terminal.")
698
+
699
+ # Debug options
700
+ debug_options = parser.add_argument_group(
701
+ title="Toil debug options.",
702
+ description="Debug options for finding problems or helping with testing."
703
+ )
704
+ debug_options.add_argument("--debugWorker", dest="debugWorker", default=False, action="store_true",
705
+ help="Experimental no forking mode for local debugging. Specifically, workers "
706
+ "are not forked and stderr/stdout are not redirected to the log.")
707
+ debug_options.add_argument("--disableWorkerOutputCapture", dest="disableWorkerOutputCapture", default=False,
708
+ action="store_true",
709
+ help="Let worker output go to worker's standard out/error instead of per-job logs.")
710
+ debug_options.add_argument("--badWorker", dest="badWorker", default=0.0, type=float,
711
+ action=make_closed_interval_action(0.0, 1.0), metavar="FLOAT",
712
+ help=f"For testing purposes randomly kill --badWorker proportion of jobs using "
713
+ f"SIGKILL. default={0.0}")
714
+ debug_options.add_argument("--badWorkerFailInterval", dest="badWorkerFailInterval", default=0.01, type=float,
715
+ action=make_open_interval_action(0.0), metavar="FLOAT", # might be cyclical?
716
+ help=f"When killing the job pick uniformly within the interval from 0.0 to "
717
+ f"--badWorkerFailInterval seconds after the worker starts. "
718
+ f"default={0.01}")
719
+
720
+ # All deprecated options:
721
+
722
+ # These are deprecated in favor of a simpler option
723
+ # ex: noLinkImports and linkImports can be simplified into a single link_imports argument
724
+ link_imports.add_argument("--noLinkImports", dest="linkImports", action="store_false",
725
+ help=SUPPRESS)
726
+ link_imports.add_argument("--linkImports", dest="linkImports", action="store_true",
727
+ help=SUPPRESS)
728
+ link_imports.set_defaults(linkImports=None)
729
+
730
+ move_exports.add_argument("--moveExports", dest="moveExports", action="store_true",
731
+ help=SUPPRESS)
732
+ move_exports.add_argument("--noMoveExports", dest="moveExports", action="store_false",
733
+ help=SUPPRESS)
734
+ link_imports.set_defaults(moveExports=None)
735
+
736
+ # dest is set to enableCaching to not conflict with the current --caching destination
737
+ caching.add_argument('--disableCaching', dest='enableCaching', action='store_false', help=SUPPRESS)
738
+ caching.set_defaults(disableCaching=None)