Skip to content

Fix when RP reports failed or canceled - #179

Merged
iparask merged 7 commits into
mainfrom
fix/rp_failed
Nov 25, 2026
Merged

iparask merged 7 commits into
mainfrom
fix/rp_failed

Conversation

@iparask

@iparask iparask commented Nov 24, 2026

Copy link
Copy Markdown
Member

It closes #158

@coveralls

coveralls commented Nov 24, 2026 •

Copy link
Copy Markdown
Collaborator

Coverage Report for CI Build 45636700190

Warning

Build has drifted: This PR's base is out of sync with its target branch, so coverage data may include unrelated changes.
Quick fix: rebase this PR. Learn more →

Coverage increased (+2.6%) to 87.485%

Details

  • Coverage increased (+2.6%) from the base build.
  • Patch coverage: 8 uncovered changes across 2 files (235 of 243 lines covered, 96.71%).
  • 1 coverage regression across 1 file.

Uncovered Changes

File Changed Covered %
src/socm/bookkeeper/bookkeeper.py 47 43 91.49%
tests/test_bookkeeper.py 135 131 97.04%
Total (5 files) 243 235 96.71%

Coverage Regressions

1 previously-covered line in 1 file lost coverage.

File Lines Losing Coverage Coverage
src/socm/bookkeeper/bookkeeper.py 1 74.22%

Coverage Stats

Coverage Status
Relevant Lines: 5089
Covered Lines: 4553
Line Coverage: 89.47%
Relevant Branches: 944
Covered Branches: 725
Branch Coverage: 76.8%
Branches in Coverage %: Yes
Coverage Strength: 0.89 hits per line

💛 - Coveralls

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Shutdown can hang when a workflow fails while a sibling is still running, and canceled RP tasks produce inconsistent states between RPEnactor and Bookkeeper.

2 open issues
What changed in this PR

This PR addresses #158 by distinguishing unsuccessful RADICAL-Pilot tasks from successful ones and updating Bookkeeper’s handling of failed workflows.

Changes:

  • Report failed and canceled RP tasks as failures rather than successful completions.
  • Preserve failed campaign status and record execution data only for successful workflows.
  • Add regression tests for terminal-state reporting, dependency handling, and campaign failure.
File Description
tests/​test_rp_enactor.py Tests terminal-state callbacks and removal of finished tasks from monitoring.
tests/​test_bookkeeper.py Tests dependency handling, failed campaign status, and success-only recording.
src/​socm/​enactor/​rp_enactor.py Separates successful tasks from failed or canceled tasks in status reporting.
src/​socm/​bookkeeper/​bookkeeper.py Preserves campaign failure and skips recording unsuccessful workflows.

Review effort: Balanced

Comment thread src/socm/bookkeeper/bookkeeper.py Resolved
Comment thread src/socm/enactor/rp_enactor.py Resolved
iparask and others added 2 commits November 24, 2026 16:35
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Shutdown can skip completed workflows’ execution records and leave resources tracked, while enactor tests bypass production status mapping and fail to verify stored failure statuses.

2 open issues
2 resolved since last review

Review effort: Balanced

Comment thread src/socm/bookkeeper/bookkeeper.py Resolved
Comment thread tests/test_rp_enactor.py Resolved

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

A critical shutdown race can overwrite FAILED with EXECUTING when another batch is queued, and the tests do not verify production mappings or internal states for failed and canceled tasks.

1 open issue
1 previously missed issue

In code that hasn't changed since last review

High severity Prevent queued batches from overwriting FAILED during termination

src/​socm/​bookkeeper/​bookkeeper.py:643

When a failed batch has another batch queued, this guard can still leave the campaign in EXECUTING. terminate() shuts down the backend before setting _terminate_event, allowing work() to start the next batch and overwrite FAILED at lines 425–428 while shutdown is pending. Signal the worker before backend shutdown and synchronize terminal-state updates with the worker's check before starting another batch.

2 resolved since last review

Review effort: Balanced

Comment thread tests/test_rp_enactor.py Resolved
iparask and others added 2 commits November 24, 2026 17:44
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
@iparask
iparask requested a balanced review from Copilot November 24, 2026 22:59
@iparask
iparask enabled auto-merge (squash) November 24, 2026 23:00
@iparask
iparask disabled auto-merge November 24, 2026 23:00

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🟡 Changes recommended

Shutdown can let the Bookkeeper monitor exit before an in-flight DONE callback arrives, leaving completed workflows unrecorded; a final _release_finished() call is needed after the enactor and both Bookkeeper threads stop.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment on lines +583 to +585
self._terminate_event.set()

# Terminate your threads.
self._enactor.terminate()
@iparask
iparask requested a balanced review from Copilot November 25, 2026 14:40

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota. Try requesting a review at a lower effort level.

An organization owner can choose the repository organization as the billing source for reviews requested by members with a paid Copilot license. Learn about Copilot code review billing.

@iparask
iparask merged commit d49ca63 into main Nov 25, 2026
6 checks passed
@iparask
iparask deleted the fix/rp_failed branch November 25, 2026 15:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

RP enactor reports failed and cancelled tasks as DONE

3 participants