fix: add retry with backoff to _update_submission and stop swallowing…#2416
Open
dconstancy wants to merge 2 commits into
Open
fix: add retry with backoff to _update_submission and stop swallowing…#2416dconstancy wants to merge 2 commits into
dconstancy wants to merge 2 commits into
Conversation
… terminal exceptions
Collaborator
|
Hello, i reviewed the code, i think the changes are good but some details seems strange like: This seems to print some secret in the logs. Secondly it seems you use a custom retry but urllib retry is alreay imported, also you add inside of the allowed methods, the method post: |
Author
|
Hello, thanks for the feedback! I've updated the PR accordingly:
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Title: fix: add retry with backoff to
_update_submission()and stop swallowing terminal exceptionsDescription
_update_submission()performs a single PATCH request with no retry. On any transient network error (502, timeout, connection reset), the submission result is permanently lost. The caller_update_status()silently swallows all exceptions, so the compute worker moves on while Django never receives the final status. The submission stays stuck inScoringorRunningforever with no user-facing error.This PR adds exponential-backoff retry to
_update_submission()and re-raises exceptions for terminal statuses so submissions no longer hang silently.Issues this PR resolves
Fixes #2415
Changes
compute_worker/compute_worker.py:_update_submission(): add retry loop with exponential backoff (5 attempts, 2^n seconds + jitter). Catches both HTTP error responses and network-levelRequestException. Only raises after all retries are exhausted._update_status(): re-raise exceptions for terminal statuses (Finished,Failed) so Celery marks the task as failed and the submission transitions toFailedin the UI instead of hanging silently. Intermediate statuses (Preparing,Running,Scoring) remain silently caught — losing an intermediate status update is not critical.totalretries from 3 to 5, addstatus_forcelist=[502, 503, 504]andallowed_methods=["PATCH", "GET", "PUT", "POST"]to automatically retry on server errors at the transport level.A checklist for hand testing
FinishedorFailedstate and no longer hang inScoring/RunningBackward compatibility
/api/submissions/{id}/is idempotent (sets status to a fixed value), so retries are safeFinished,Failed) now propagate — this is strictly better than the previous silent lossChecklist