Repository navigation
[Jobs] Ignore 406 from metrics endpoint for finished jobs - #5091
Merged
Merged
Conversation
|
The docs for this PR live here. All of your documentation changes will be reflected on that endpoint. The docs are available until 30 days after the last update. |
Contributor
|
This PR has been shipped as part of the v2.2.0 release. |
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.
The Jobs API now answers
406 Not Acceptableinstead of500when asked for the live metrics of a job that is no longer running (internal PR: https://github.com/huggingface-internal/workloads/pull/4992).fetch_job_metricsonly ignores 500, so it now raises on any finished job, andhf jobs statsfails as soon as one of the requested jobs has finished.Summary
/metricsreturns 406 for COMPLETED, ERROR and CANCELED jobs, and only once the job has stopped (SCHEDULING → read timeout, RUNNING → 200 with samples, then 406). Running jobs are not affected.Example
On
main, with a finished job:With this PR:
Combined with #5090,
hf jobs statson a finished job printsWarning: No stats available for Job <id>. Is it running?instead of failing.Note
Low Risk
Narrow change to ignored HTTP status codes on job metrics streaming; running jobs unchanged and 500 handling preserved.
Overview
Updates
fetch_job_metricsso the Hub’s new 406 Not Acceptable response for finished jobs is treated like the old 500, instead of surfacing a client error.tolerated_status_codesfor the metrics SSE route is extended from(500,)to(406, 500), with an inline comment noting the API behavior change. Callers such ashf jobs statscan poll mixed running/finished jobs without failing when metrics are no longer available.Reviewed by Cursor Bugbot for commit fd45639. Bugbot is set up for automated code reviews on this repo. Configure here.