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.
Files changed (93) hide show
  1. toil/__init__.py +1 -232
  2. toil/batchSystems/abstractBatchSystem.py +22 -13
  3. toil/batchSystems/abstractGridEngineBatchSystem.py +59 -45
  4. toil/batchSystems/awsBatch.py +8 -8
  5. toil/batchSystems/contained_executor.py +4 -5
  6. toil/batchSystems/gridengine.py +1 -1
  7. toil/batchSystems/htcondor.py +5 -5
  8. toil/batchSystems/kubernetes.py +25 -11
  9. toil/batchSystems/local_support.py +3 -3
  10. toil/batchSystems/lsf.py +2 -2
  11. toil/batchSystems/mesos/batchSystem.py +4 -4
  12. toil/batchSystems/mesos/executor.py +3 -2
  13. toil/batchSystems/options.py +9 -0
  14. toil/batchSystems/singleMachine.py +11 -10
  15. toil/batchSystems/slurm.py +64 -22
  16. toil/batchSystems/torque.py +1 -1
  17. toil/bus.py +7 -3
  18. toil/common.py +36 -13
  19. toil/cwl/cwltoil.py +365 -312
  20. toil/deferred.py +1 -1
  21. toil/fileStores/abstractFileStore.py +17 -17
  22. toil/fileStores/cachingFileStore.py +2 -2
  23. toil/fileStores/nonCachingFileStore.py +1 -1
  24. toil/job.py +228 -60
  25. toil/jobStores/abstractJobStore.py +18 -10
  26. toil/jobStores/aws/jobStore.py +280 -218
  27. toil/jobStores/aws/utils.py +57 -29
  28. toil/jobStores/conftest.py +2 -2
  29. toil/jobStores/fileJobStore.py +2 -2
  30. toil/jobStores/googleJobStore.py +3 -4
  31. toil/leader.py +72 -24
  32. toil/lib/aws/__init__.py +26 -10
  33. toil/lib/aws/iam.py +2 -2
  34. toil/lib/aws/session.py +62 -22
  35. toil/lib/aws/utils.py +73 -37
  36. toil/lib/conversions.py +5 -1
  37. toil/lib/ec2.py +118 -69
  38. toil/lib/expando.py +1 -1
  39. toil/lib/io.py +14 -2
  40. toil/lib/misc.py +1 -3
  41. toil/lib/resources.py +55 -21
  42. toil/lib/retry.py +12 -5
  43. toil/lib/threading.py +2 -2
  44. toil/lib/throttle.py +1 -1
  45. toil/options/common.py +27 -24
  46. toil/provisioners/__init__.py +9 -3
  47. toil/provisioners/abstractProvisioner.py +9 -7
  48. toil/provisioners/aws/__init__.py +20 -15
  49. toil/provisioners/aws/awsProvisioner.py +406 -329
  50. toil/provisioners/gceProvisioner.py +2 -2
  51. toil/provisioners/node.py +13 -5
  52. toil/server/app.py +1 -1
  53. toil/statsAndLogging.py +58 -16
  54. toil/test/__init__.py +27 -12
  55. toil/test/batchSystems/batchSystemTest.py +40 -33
  56. toil/test/batchSystems/batch_system_plugin_test.py +79 -0
  57. toil/test/batchSystems/test_slurm.py +1 -1
  58. toil/test/cwl/cwlTest.py +8 -91
  59. toil/test/cwl/seqtk_seq.cwl +1 -1
  60. toil/test/docs/scriptsTest.py +10 -13
  61. toil/test/jobStores/jobStoreTest.py +33 -49
  62. toil/test/lib/aws/test_iam.py +2 -2
  63. toil/test/provisioners/aws/awsProvisionerTest.py +51 -34
  64. toil/test/provisioners/clusterTest.py +90 -8
  65. toil/test/server/serverTest.py +2 -2
  66. toil/test/src/autoDeploymentTest.py +1 -1
  67. toil/test/src/dockerCheckTest.py +2 -1
  68. toil/test/src/environmentTest.py +125 -0
  69. toil/test/src/fileStoreTest.py +1 -1
  70. toil/test/src/jobDescriptionTest.py +18 -8
  71. toil/test/src/jobTest.py +1 -1
  72. toil/test/src/realtimeLoggerTest.py +4 -0
  73. toil/test/src/workerTest.py +52 -19
  74. toil/test/utils/toilDebugTest.py +61 -3
  75. toil/test/utils/utilsTest.py +20 -18
  76. toil/test/wdl/wdltoil_test.py +24 -71
  77. toil/test/wdl/wdltoil_test_kubernetes.py +77 -0
  78. toil/toilState.py +68 -9
  79. toil/utils/toilDebugJob.py +153 -26
  80. toil/utils/toilLaunchCluster.py +12 -2
  81. toil/utils/toilRsyncCluster.py +7 -2
  82. toil/utils/toilSshCluster.py +7 -3
  83. toil/utils/toilStats.py +2 -1
  84. toil/utils/toilStatus.py +97 -51
  85. toil/version.py +10 -10
  86. toil/wdl/wdltoil.py +318 -51
  87. toil/worker.py +96 -69
  88. {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/LICENSE +25 -0
  89. {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/METADATA +55 -21
  90. {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/RECORD +93 -90
  91. {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/WHEEL +1 -1
  92. {toil-6.1.0.dist-info → toil-7.0.0.dist-info}/entry_points.txt +0 -0
  93. {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 (add_all_batchsystem_options,
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, baseVersion
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
- provisioner_options: bool = False, jobstore_option: bool = True, prog: Optional[str] = None
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 convertable to a uuid.UUID.
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 convertable to a uuid.UUID
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: