Skip to content

Commit 99fa6f4

Browse files
committed
Restore DRMAA (GridExecutor) as primary cluster execution path
The run() function was changed in 0.6.18 to always use get_executor(), which routes all cluster jobs through the new CLI-based SlurmExecutor/ SGEExecutor classes, bypassing GridExecutor (DRMAA) entirely. This broke all users with a working DRMAA installation. Fix: - run() now uses GridExecutor when DRMAA is available and a session is active; CLI-based executors are used only as a fallback when DRMAA is absent. - will_run_on_cluster() no longer raises when DRMAA is missing; it returns False so the CLI executor fallback can proceed cleanly.
1 parent ac78883 commit 99fa6f4

1 file changed

Lines changed: 17 additions & 12 deletions

File tree

cgatcore/pipeline/execution.py

Lines changed: 17 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -540,17 +540,14 @@ def will_run_on_cluster(options):
540540
# First check if we're explicitly running without cluster
541541
if options.get("without_cluster", False):
542542
return False
543-
543+
544544
wants_cluster = options.get("to_cluster", True)
545-
546-
# Only raise error if DRMAA is required but not available
547-
if wants_cluster and not HAS_DRMAA:
548-
raise ValueError(
549-
"Cluster execution requested (to_cluster=True) but DRMAA library is not available. "
550-
"Please install drmaa package in your environment to enable cluster execution.")
551-
552-
return (wants_cluster
553-
and HAS_DRMAA
545+
546+
# Return True only when DRMAA is present and a session is active.
547+
# When DRMAA is absent the CLI-based executors in get_executor() are used
548+
# as a fallback, so we do not raise here.
549+
return (wants_cluster
550+
and HAS_DRMAA
554551
and GLOBAL_SESSION is not None)
555552

556553

@@ -1522,8 +1519,16 @@ def run(statement, **kwargs):
15221519
logger.info("Dry-run: {}".format(statement))
15231520
return []
15241521

1525-
# Use get_executor to get the appropriate executor
1526-
executor = get_executor(options) # Updated to use get_executor
1522+
# Prefer DRMAA (GridExecutor) when available - it is the stable, battle-tested
1523+
# path. Fall back to the CLI-based executors only when DRMAA is absent.
1524+
wants_cluster = (
1525+
options.get("to_cluster", True)
1526+
and not options.get("without_cluster", False)
1527+
)
1528+
if wants_cluster and HAS_DRMAA and GLOBAL_SESSION is not None:
1529+
executor = GridExecutor(**options)
1530+
else:
1531+
executor = get_executor(options)
15271532

15281533
# Execute statement list within the context of the executor
15291534
with executor as e:

0 commit comments

Comments
 (0)