Skip to content

Migrate Dragon backend to 0.14.1 - #74

Draft
AymenFJA wants to merge 11 commits into
mainfrom
feature/pre-release-0.5.0
Draft

Migrate Dragon backend to 0.14.1#74
AymenFJA wants to merge 11 commits into
mainfrom
feature/pre-release-0.5.0

Conversation

@AymenFJA

@AymenFJA AymenFJA commented Jul 10, 2026

Copy link
Copy Markdown
Contributor
  • Remove DragonExecutionBackendV1 and DragonExecutionBackendV2 entirely across all source, tests, docs, and examples.
  • Migrate the remaining backend to the Dragon 0.14.1-rc public API and rename it to DragonExecutionBackend.
  • DragonExecutionBackendV3 is kept as a deprecated alias with a DeprecationWarning. The discovery layer registers dragon_v3 as a backward-compatible alias for dragon.

…e V3

Remove DragonExecutionBackendV1 and DragonExecutionBackendV2 entirely across
all source, tests, docs, and examples. Migrate the remaining backend to the
Dragon 0.14.1-rc public API and rename it to DragonExecutionBackend.
DragonExecutionBackendV3 is kept as a deprecated alias with a DeprecationWarning.
The discovery layer registers dragon_v3 as a backward-compatible alias for dragon.

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request consolidates the Dragon execution backends by removing legacy versions (V1 and V2) and renaming DragonExecutionBackendV3 to DragonExecutionBackend across the codebase, documentation, examples, and tests. Feedback on the changes highlights a critical syntax error in pyproject.toml where the dragon dependency definition is malformed, and identifies several unit tests in test_backend_execution_dragon.py that are tautological because they replicate production logic rather than executing the actual backend methods.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

Comment thread pyproject.toml Outdated
dask = ["dask[distributed]>=2023.0.0"]
radical_pilot = ["radical.pilot>=1.30.0"]
dragon = ["dragonhpc==0.14.0"] # Requires Python >= 3.10, supports up to 3.13
dragon = ["dragonhpc] # Requires Python >= 3.10, supports up to 3.13

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

critical

The dependency definition for dragon is syntactically invalid because it is missing a closing double quote and a closing bracket (]). This will cause a TOML parsing error when pyproject.toml is loaded. Since the PR migrates the Dragon backend to 0.14.1, this should be updated to a valid dependency string such as ["dragonhpc>=0.14.1"].

Suggested change
dragon = ["dragonhpc] # Requires Python >= 3.10, supports up to 3.13
dragon = ["dragonhpc>=0.14.1"] # Requires Python >= 3.10, supports up to 3.13

Comment on lines +713 to +733
def test_monitor_loop_get_called_after_poll(backend_dragon):
"""After poll() returns a tuid, get(block=False) is called on the corresponding task."""
uid = "task.poll-get"
mock_task = MagicMock()
mock_task.core.manager_idx = None
uid = "task.monitor-no-idx"
backend_v3._monitored_batches[uid] = (mock_task, "flow-uid")
mock_task.get.return_value = "done-result"
mock_task.traceback = None
mock_task.stdout_path = None
mock_task.stderr_path = None
backend_dragon._monitored_batches[uid] = (mock_task, "flow-uid")

# Simulate the drain: poll returned uid, now process it
entry = backend_dragon._monitored_batches.pop(uid, None)
assert entry is not None
batch_task, flow_uid = entry
result = batch_task.get(block=False)
stdout = batch_task.stdout_path or ""
stderr = batch_task.stderr_path or ""
completed = [(flow_uid, result, None, False, stdout, stderr)]

mock_task.get.assert_called_once_with(block=False)
assert completed == [("flow-uid", "done-result", None, False, "", "")]

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

medium

These unit tests (test_monitor_loop_get_called_after_poll, test_monitor_loop_skips_cancelled_tuid, and test_monitor_loop_reads_paths_from_batch_task) are tautological because they do not actually execute any code from the DragonExecutionBackend class (such as _monitor_loop). Instead, they manually replicate the logic of _monitor_loop inside the test body and assert against the replicated logic. This means if the actual implementation of _monitor_loop in dragon.py is broken or changed, these tests will still pass.

Recommendation:
To make these tests meaningful, consider refactoring _monitor_loop in dragon.py to extract the completion processing logic into a separate helper method (e.g., _process_completions(self, tuids: list[str]) -> list[tuple]). This helper method can then be directly invoked and verified in these unit tests, ensuring that the actual production code is being tested.

MattToast and others added 3 commits July 14, 2026 13:46
Add missing double quote to pyproject.toml (@MattToast )
…n 0.14.1-rc

- Enable task_logs=True by default in DragonExecutionBackend so task.stdout
  is always populated for capture_stdio=False tasks; warn when disabled via
  batch_kwargs={"task_logs": False}
- Detect non-zero int/list[int] exit codes from Dragon process/job tasks and
  convert to raised=True + SystemExit so RHAPSODY delivers FAILED correctly
- Replace execution_mode string in _task_registry with is_native_function bool
  computed once at build_task time; gates exit-code check in _monitor_loop
- Remove type=mpi routing (MPI users must use process_templates)
- Update docs with Dragon-specific stdout/stderr behavior and process-mode
  function warning; fix inaccurate note about function tasks being unaffected
  by capture_stdio on DragonExecutionBackend
@AymenFJA AymenFJA self-assigned this Jul 14, 2026
@AymenFJA AymenFJA added enhancement New feature or request Critical core execution-backends Q3 Targeting Q3 milestones labels Jul 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

core Critical enhancement New feature or request execution-backends Q3 Targeting Q3 milestones

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants