toil 6.1.0__py3-none-any.whl → 7.0.0__py3-none-any.whl
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- toil/__init__.py +1 -232
- toil/batchSystems/abstractBatchSystem.py +22 -13
- toil/batchSystems/abstractGridEngineBatchSystem.py +59 -45
- toil/batchSystems/awsBatch.py +8 -8
- toil/batchSystems/contained_executor.py +4 -5
- toil/batchSystems/gridengine.py +1 -1
- toil/batchSystems/htcondor.py +5 -5
- toil/batchSystems/kubernetes.py +25 -11
- toil/batchSystems/local_support.py +3 -3
- toil/batchSystems/lsf.py +2 -2
- toil/batchSystems/mesos/batchSystem.py +4 -4
- toil/batchSystems/mesos/executor.py +3 -2
- toil/batchSystems/options.py +9 -0
- toil/batchSystems/singleMachine.py +11 -10
- toil/batchSystems/slurm.py +64 -22
- toil/batchSystems/torque.py +1 -1
- toil/bus.py +7 -3
- toil/common.py +36 -13
- toil/cwl/cwltoil.py +365 -312
- toil/deferred.py +1 -1
- toil/fileStores/abstractFileStore.py +17 -17
- toil/fileStores/cachingFileStore.py +2 -2
- toil/fileStores/nonCachingFileStore.py +1 -1
- toil/job.py +228 -60
- toil/jobStores/abstractJobStore.py +18 -10
- toil/jobStores/aws/jobStore.py +280 -218
- toil/jobStores/aws/utils.py +57 -29
- toil/jobStores/conftest.py +2 -2
- toil/jobStores/fileJobStore.py +2 -2
- toil/jobStores/googleJobStore.py +3 -4
- toil/leader.py +72 -24
- toil/lib/aws/__init__.py +26 -10
- toil/lib/aws/iam.py +2 -2
- toil/lib/aws/session.py +62 -22
- toil/lib/aws/utils.py +73 -37
- toil/lib/conversions.py +5 -1
- toil/lib/ec2.py +118 -69
- toil/lib/expando.py +1 -1
- toil/lib/io.py +14 -2
- toil/lib/misc.py +1 -3
- toil/lib/resources.py +55 -21
- toil/lib/retry.py +12 -5
- toil/lib/threading.py +2 -2
- toil/lib/throttle.py +1 -1
- toil/options/common.py +27 -24
- toil/provisioners/__init__.py +9 -3
- toil/provisioners/abstractProvisioner.py +9 -7
- toil/provisioners/aws/__init__.py +20 -15
- toil/provisioners/aws/awsProvisioner.py +406 -329
- toil/provisioners/gceProvisioner.py +2 -2
- toil/provisioners/node.py +13 -5
- toil/server/app.py +1 -1
- toil/statsAndLogging.py +58 -16
- toil/test/__init__.py +27 -12
- toil/test/batchSystems/batchSystemTest.py +40 -33
- toil/test/batchSystems/batch_system_plugin_test.py +79 -0
- toil/test/batchSystems/test_slurm.py +1 -1
- toil/test/cwl/cwlTest.py +8 -91
- toil/test/cwl/seqtk_seq.cwl +1 -1
- toil/test/docs/scriptsTest.py +10 -13
- toil/test/jobStores/jobStoreTest.py +33 -49
- toil/test/lib/aws/test_iam.py +2 -2
- toil/test/provisioners/aws/awsProvisionerTest.py +51 -34
- toil/test/provisioners/clusterTest.py +90 -8
- toil/test/server/serverTest.py +2 -2
- toil/test/src/autoDeploymentTest.py +1 -1
- toil/test/src/dockerCheckTest.py +2 -1
- toil/test/src/environmentTest.py +125 -0
- toil/test/src/fileStoreTest.py +1 -1
- toil/test/src/jobDescriptionTest.py +18 -8
- toil/test/src/jobTest.py +1 -1
- toil/test/src/realtimeLoggerTest.py +4 -0
- toil/test/src/workerTest.py +52 -19
- toil/test/utils/toilDebugTest.py +61 -3
- toil/test/utils/utilsTest.py +20 -18
- toil/test/wdl/wdltoil_test.py +24 -71
- toil/test/wdl/wdltoil_test_kubernetes.py +77 -0
- toil/toilState.py +68 -9
- toil/utils/toilDebugJob.py +153 -26
- toil/utils/toilLaunchCluster.py +12 -2
- toil/utils/toilRsyncCluster.py +7 -2
- toil/utils/toilSshCluster.py +7 -3
- toil/utils/toilStats.py +2 -1
- toil/utils/toilStatus.py +97 -51
- toil/version.py +10 -10
- toil/wdl/wdltoil.py +318 -51
- toil/worker.py +96 -69
- {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/LICENSE +25 -0
- {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/METADATA +55 -21
- {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/RECORD +93 -90
- {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/WHEEL +1 -1
- {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/entry_points.txt +0 -0
- {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/top_level.txt +0 -0
toil/common.py
CHANGED
|
@@ -64,8 +64,7 @@ else:
|
|
|
64
64
|
from typing_extensions import Literal
|
|
65
65
|
|
|
66
66
|
from toil import logProcessContext, lookupEnvVar
|
|
67
|
-
from toil.batchSystems.options import
|
|
68
|
-
set_batchsystem_options)
|
|
67
|
+
from toil.batchSystems.options import set_batchsystem_options
|
|
69
68
|
from toil.bus import (ClusterDesiredSizeMessage,
|
|
70
69
|
ClusterSizeMessage,
|
|
71
70
|
JobCompletedMessage,
|
|
@@ -75,17 +74,15 @@ from toil.bus import (ClusterDesiredSizeMessage,
|
|
|
75
74
|
MessageBus,
|
|
76
75
|
QueueSizeMessage)
|
|
77
76
|
from toil.fileStores import FileID
|
|
78
|
-
from toil.lib.aws import zone_to_region, build_tag_dict_from_env
|
|
79
77
|
from toil.lib.compatibility import deprecated
|
|
80
78
|
from toil.lib.io import try_path, AtomicFileCreate
|
|
81
79
|
from toil.lib.retry import retry
|
|
82
80
|
from toil.provisioners import (add_provisioner_options,
|
|
83
|
-
cluster_factory
|
|
84
|
-
parse_node_types)
|
|
81
|
+
cluster_factory)
|
|
85
82
|
from toil.realtimeLogger import RealtimeLogger
|
|
86
83
|
from toil.statsAndLogging import (add_logging_options,
|
|
87
84
|
set_logging_from_options)
|
|
88
|
-
from toil.version import dockerRegistry, dockerTag, version
|
|
85
|
+
from toil.version import dockerRegistry, dockerTag, version
|
|
89
86
|
|
|
90
87
|
if TYPE_CHECKING:
|
|
91
88
|
from toil.batchSystems.abstractBatchSystem import AbstractBatchSystem
|
|
@@ -125,6 +122,7 @@ class Config:
|
|
|
125
122
|
kubernetes_owner: Optional[str]
|
|
126
123
|
kubernetes_service_account: Optional[str]
|
|
127
124
|
kubernetes_pod_timeout: float
|
|
125
|
+
kubernetes_privileged: bool
|
|
128
126
|
tes_endpoint: str
|
|
129
127
|
tes_user: str
|
|
130
128
|
tes_password: str
|
|
@@ -138,6 +136,7 @@ class Config:
|
|
|
138
136
|
"""The backing scheduler will be instructed, if possible, to save logs
|
|
139
137
|
to this directory, where the leader can read them."""
|
|
140
138
|
statePollingWait: int
|
|
139
|
+
state_polling_timeout: int
|
|
141
140
|
disableAutoDeployment: bool
|
|
142
141
|
|
|
143
142
|
# Core options
|
|
@@ -149,6 +148,7 @@ class Config:
|
|
|
149
148
|
workflowAttemptNumber: int
|
|
150
149
|
jobStore: str
|
|
151
150
|
logLevel: str
|
|
151
|
+
colored_logs: bool
|
|
152
152
|
workDir: Optional[str]
|
|
153
153
|
coordination_dir: Optional[str]
|
|
154
154
|
noStdOutErr: bool
|
|
@@ -209,6 +209,7 @@ class Config:
|
|
|
209
209
|
doubleMem: bool
|
|
210
210
|
maxJobDuration: int
|
|
211
211
|
rescueJobsFrequency: int
|
|
212
|
+
job_store_timeout: float
|
|
212
213
|
|
|
213
214
|
# Log management
|
|
214
215
|
maxLogFileSize: int
|
|
@@ -374,6 +375,7 @@ class Config:
|
|
|
374
375
|
set_option("doubleMem")
|
|
375
376
|
set_option("maxJobDuration")
|
|
376
377
|
set_option("rescueJobsFrequency")
|
|
378
|
+
set_option("job_store_timeout")
|
|
377
379
|
|
|
378
380
|
# Log management
|
|
379
381
|
set_option("maxLogFileSize")
|
|
@@ -400,6 +402,7 @@ class Config:
|
|
|
400
402
|
set_option("badWorker")
|
|
401
403
|
set_option("badWorkerFailInterval")
|
|
402
404
|
set_option("logLevel")
|
|
405
|
+
set_option("colored_logs")
|
|
403
406
|
|
|
404
407
|
# Apply overrides as highest priority
|
|
405
408
|
# Override workDir with value of TOIL_WORKDIR_OVERRIDE if it exists
|
|
@@ -411,8 +414,6 @@ class Config:
|
|
|
411
414
|
|
|
412
415
|
self.check_configuration_consistency()
|
|
413
416
|
|
|
414
|
-
logger.debug("Loaded configuration: %s", vars(options))
|
|
415
|
-
|
|
416
417
|
def check_configuration_consistency(self) -> None:
|
|
417
418
|
"""Old checks that cannot be fit into an action class for argparse"""
|
|
418
419
|
if self.writeLogs and self.writeLogsGzip:
|
|
@@ -600,7 +601,10 @@ def generate_config(filepath: str) -> None:
|
|
|
600
601
|
|
|
601
602
|
|
|
602
603
|
def parser_with_common_options(
|
|
603
|
-
|
|
604
|
+
provisioner_options: bool = False,
|
|
605
|
+
jobstore_option: bool = True,
|
|
606
|
+
prog: Optional[str] = None,
|
|
607
|
+
default_log_level: Optional[int] = None
|
|
604
608
|
) -> ArgParser:
|
|
605
609
|
parser = ArgParser(prog=prog or "Toil", formatter_class=ArgumentDefaultsHelpFormatter)
|
|
606
610
|
|
|
@@ -611,7 +615,7 @@ def parser_with_common_options(
|
|
|
611
615
|
parser.add_argument('jobStore', type=str, help=JOBSTORE_HELP)
|
|
612
616
|
|
|
613
617
|
# always add these
|
|
614
|
-
add_logging_options(parser)
|
|
618
|
+
add_logging_options(parser, default_log_level)
|
|
615
619
|
parser.add_argument("--version", action='version', version=version)
|
|
616
620
|
parser.add_argument("--tempDirRoot", dest="tempDirRoot", type=str, default=tempfile.gettempdir(),
|
|
617
621
|
help="Path to where temporary directory containing all temp files are created, "
|
|
@@ -709,7 +713,7 @@ def addOptions(parser: ArgumentParser, jobstore_as_flag: bool = False, cwl: bool
|
|
|
709
713
|
help="WDL document URI")
|
|
710
714
|
parser.add_argument("inputs_uri", type=str, nargs='?',
|
|
711
715
|
help="WDL input JSON URI")
|
|
712
|
-
parser.add_argument("--input", "-i", dest="inputs_uri", type=str,
|
|
716
|
+
parser.add_argument("--input", "--inputs", "-i", dest="inputs_uri", type=str,
|
|
713
717
|
help="WDL input JSON URI")
|
|
714
718
|
check_arguments(typ="wdl")
|
|
715
719
|
|
|
@@ -717,7 +721,7 @@ def addOptions(parser: ArgumentParser, jobstore_as_flag: bool = False, cwl: bool
|
|
|
717
721
|
@lru_cache(maxsize=None)
|
|
718
722
|
def getNodeID() -> str:
|
|
719
723
|
"""
|
|
720
|
-
Return unique ID of the current node (host). The resulting string will be
|
|
724
|
+
Return unique ID of the current node (host). The resulting string will be convertible to a uuid.UUID.
|
|
721
725
|
|
|
722
726
|
Tries several methods until success. The returned ID should be identical across calls from different processes on
|
|
723
727
|
the same node at least until the next OS reboot.
|
|
@@ -765,7 +769,7 @@ def getNodeID() -> str:
|
|
|
765
769
|
"experience cryptic job failures")
|
|
766
770
|
if len(nodeID.replace('-', '')) < UUID_LENGTH:
|
|
767
771
|
# Some platforms (Mac) give us not enough actual hex characters.
|
|
768
|
-
# Repeat them so the result is
|
|
772
|
+
# Repeat them so the result is convertible to a uuid.UUID
|
|
769
773
|
nodeID = nodeID.replace('-', '')
|
|
770
774
|
num_repeats = UUID_LENGTH // len(nodeID) + 1
|
|
771
775
|
nodeID = nodeID * num_repeats
|
|
@@ -809,6 +813,7 @@ class Toil(ContextManager["Toil"]):
|
|
|
809
813
|
set_logging_from_options(self.options)
|
|
810
814
|
config = Config()
|
|
811
815
|
config.setOptions(self.options)
|
|
816
|
+
logger.debug("Loaded configuration: %s", vars(self.options))
|
|
812
817
|
if config.jobStore is None:
|
|
813
818
|
raise RuntimeError("No jobstore provided!")
|
|
814
819
|
jobStore = self.getJobStore(config.jobStore)
|
|
@@ -883,6 +888,16 @@ class Toil(ContextManager["Toil"]):
|
|
|
883
888
|
"""
|
|
884
889
|
self._assertContextManagerUsed()
|
|
885
890
|
|
|
891
|
+
from toil.job import Job
|
|
892
|
+
|
|
893
|
+
# Check that the rootJob is an instance of the Job class
|
|
894
|
+
if not isinstance(rootJob, Job):
|
|
895
|
+
raise RuntimeError("The type of the root job is not a job.")
|
|
896
|
+
|
|
897
|
+
# Check that the rootJob has been initialized
|
|
898
|
+
rootJob.check_initialized()
|
|
899
|
+
|
|
900
|
+
|
|
886
901
|
# Write shared files to the job store
|
|
887
902
|
self._jobStore.write_leader_pid()
|
|
888
903
|
self._jobStore.write_leader_node_id()
|
|
@@ -1263,6 +1278,8 @@ class Toil(ContextManager["Toil"]):
|
|
|
1263
1278
|
--workDir flag
|
|
1264
1279
|
:param config_coordination_dir: Value passed to the program using the
|
|
1265
1280
|
--coordinationDir flag
|
|
1281
|
+
:param workflow_id: Used if a tmpdir_prefix exists to create full
|
|
1282
|
+
directory paths unique per workflow
|
|
1266
1283
|
|
|
1267
1284
|
:return: Path to the Toil coordination directory. Ought to be on a
|
|
1268
1285
|
POSIX filesystem that allows directories containing open files to be
|
|
@@ -1291,6 +1308,9 @@ class Toil(ContextManager["Toil"]):
|
|
|
1291
1308
|
os.path.join(os.environ['XDG_RUNTIME_DIR'], 'toil'))) or
|
|
1292
1309
|
# Try under /run/lock. It might be a temp dir style sticky directory.
|
|
1293
1310
|
try_path('/run/lock') or
|
|
1311
|
+
# Try all possible temp directories, falling back to the current working
|
|
1312
|
+
# directory
|
|
1313
|
+
tempfile.gettempdir() or
|
|
1294
1314
|
# Finally, fall back on the work dir and hope it's a legit filesystem.
|
|
1295
1315
|
cls.getToilWorkDir(config_work_dir)
|
|
1296
1316
|
)
|
|
@@ -1370,6 +1390,7 @@ class Toil(ContextManager["Toil"]):
|
|
|
1370
1390
|
|
|
1371
1391
|
# Make a per-workflow and node subdirectory
|
|
1372
1392
|
subdir = os.path.join(base, cls.get_workflow_path_component(workflow_id))
|
|
1393
|
+
|
|
1373
1394
|
# Make it exist
|
|
1374
1395
|
os.makedirs(subdir, exist_ok=True)
|
|
1375
1396
|
# TODO: May interfere with workflow directory creation logging if it's the same directory.
|
|
@@ -1427,6 +1448,8 @@ class ToilMetrics:
|
|
|
1427
1448
|
clusterName = str(provisioner.clusterName)
|
|
1428
1449
|
if provisioner._zone is not None:
|
|
1429
1450
|
if provisioner.cloud == 'aws':
|
|
1451
|
+
# lazy import to avoid AWS dependency if the aws extra is not installed
|
|
1452
|
+
from toil.lib.aws import zone_to_region
|
|
1430
1453
|
# Remove AZ name
|
|
1431
1454
|
region = zone_to_region(provisioner._zone)
|
|
1432
1455
|
else:
|