Repository navigation
Stop monitor_tasks polling after the timeout expires - #306
Open
arpitjain099 wants to merge 1 commit into
Open
arpitjain099 wants to merge 1 commit into
arpitjain099 wants to merge 1 commit into
Conversation
The timeout branch logged a warning but never left the while loop, so the next iteration re-entered it immediately and the call never returned. The code after the loop already reports the timeout and returns completed=False, so break out of the loop and let it run. Co-Authored-By: Claude <noreply@anthropic.com> Signed-off-by: Arpit Jain <arpitjain099@gmail.com>
This branch has not been deployed
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.
Please describe the bug this fixes or the feature this adds.
Fixes #297. The timeout branch in
monitor_taskslogs a warning and then drops straight into the next iteration of thewhileloop. Nothing on that path changesjob.stateorcompleted, so the next pass lands in the same branch and the call never returns. There is no sleep on that path either, so it spins. Everything after the loop was already written for this case, down to logging the timeout and returning the dict withcompleted=False, so all that was missing was thebreak.The issue also flags the docstring promising a
RuntimeErroron timeout. Nothing in the function raises, so I replaced that line with what actually comes back. Happy to raise instead if you would rather keep the documented contract.I left
_cloudclient.pyalone because #296 is already reworkingmonitor_job.Please describe how you tested this change. Include unit tests whenever possible.
Added
test_monitor_tasks_returns_when_timeout_expires. It feeds a fixed clock so the first poll falls inside the deadline and the second is past it, with one task still running, then checks the returned counts. Against the unpatched function the clock runs out and you can see the timeout warning logged twice. Full suite goes from 274 passed to 275. The single failure,test_download_job_stats, already fails on main.Did you create or modify any associated documentation with this change? If documentation is not included in PR, please link to related documentation.
Only the
monitor_tasksdocstring.If you added or modified HTML, did you check that it was 508 compliant?
No HTML.
Please tag any specific reviewers you would like to review this PR
Whoever owns batch_helpers.py.
Please include the following checks for open source contributing?