fix: add retry with backoff to _update_submission and stop swallowing…#2416
Open
dconstancy wants to merge 1 commit into
Open
fix: add retry with backoff to _update_submission and stop swallowing…#2416dconstancy wants to merge 1 commit into
dconstancy wants to merge 1 commit into
Conversation
… terminal exceptions
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 exceptionsFixes #2415
Problem
_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.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.Retry behavior observed in logs (post-fix):
Backward 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 loss