Repository: DataBiosphere/toil

Issue:
Polling interval for LSF and SGE batch systems is too low
We would like to be able to raise the polling interval for our batch systems without having to change the default in the code (which is how we've previously solved this issue)

I've made this issue to be linked to a PR I will push so we can raise this interval through the command line.


Additionally, I'd like to point out a slightly confusing aspect of the Config object. This line:

https://github.com/DataBiosphere/toil/blob/33f30b34b7a6cfb74be9d7863d08ce2f7be58475/src/toil/batchSystems/options.py#L165

Actually has no effect, because it is called before a line in `common.py` that resets the value to `1`:

https://github.com/DataBiosphere/toil/blob/33f30b34b7a6cfb74be9d7863d08ce2f7be58475/src/toil/common.py#L73
https://github.com/DataBiosphere/toil/blob/33f30b34b7a6cfb74be9d7863d08ce2f7be58475/src/toil/common.py#L95

Therefore the comment in `options.py` is misleading, and `1` will always be used.

It may be sensible to have an additional PR to remove the `self.statePollingWait = 1`, or switch its order with the `setDefaultBatchOptions(self)` call

┆Issue is synchronized with this [Jira Task](https://ucsc-cgl.atlassian.net/browse/TOIL-724)
┆Issue Number: TOIL-724



Discussion:

Resolving patch:
diff --git a/src/toil/batchSystems/options.py b/src/toil/batchSystems/options.py
--- a/src/toil/batchSystems/options.py
+++ b/src/toil/batchSystems/options.py
@@ -151,7 +151,7 @@ def setDefaultOptions(config):
     config.batchSystem = "single_machine"
     config.disableAutoDeployment = False
     config.environment = {}
-    config.statePollingWait = None  # if not set, will default to seconds in getWaitDuration()
+    config.statePollingWait = None
     config.maxLocalJobs = cpu_count()
     config.manualMemArgs = False
 
diff --git a/src/toil/common.py b/src/toil/common.py
--- a/src/toil/common.py
+++ b/src/toil/common.py
@@ -381,6 +381,9 @@ def _addOptions(addGroupFn, config):
     addOptionFn = addGroupFn("toil options for specifying the batch system",
                              "Allows the specification of the batch system, and arguments to the "
                              "batch system/big batch system (see below).")
+    addOptionFn("--statePollingWait", dest="statePollingWait", default=1, type=int,
+                help=("Time, in seconds, to wait before doing a scheduler query for job state. "
+                      "Return cached results if within the waiting period."))
     addBatchOptions(addOptionFn, config)
 
     #
@@ -491,9 +494,6 @@ def _addOptions(addGroupFn, config):
                     "enumerate running jobs quickly enough, or if polling for running jobs is "
                     "placing an unacceptable load on a shared cluster. default=%s" %
                     config.deadlockCheckInterval))
-        addOptionFn("--statePollingWait", dest="statePollingWait", default=1, type=int,
-                    help=("Time, in seconds, to wait before doing a scheduler query for job state. "
-                          "Return cached results if within the waiting period."))
 
     #
     # Resource requirements


Test patch: