Repository navigation
fix(trainer): keep pre_flight running when the Hugging Face lookup fails - #668
shrxyas-246 wants to merge 1 commit into
Conversation
Since kubeflow#628, pre_flight returns early when any of its checks fails. That includes the resource estimate, which only asks the Hugging Face Hub for the model's size. When the Hub can't give one (no network or an air-gapped cluster, HF_HUB_OFFLINE=1, a 429 or 5xx from the Hub, or a model with no parameter count in its metadata), estimate_resources returns SDK_ERROR and pre_flight(model=...) fails even though the cluster is fine. SDK_ERROR also counts against the circuit breaker. After five such calls (the default threshold) the breaker for pre_flight opens, and every pre_flight call, including ones without a model, gets "Circuit breaker open for 'pre_flight' — K8s API may be degraded". The breaker is shared by all sessions, so on an HTTP server this blocks every user. An SDK_ERROR from the estimate now stays in the report under "estimate", as it did before kubeflow#628, and the cluster and runtime checks still run. A bad model ID or argument (VALIDATION_ERROR) still fails the whole call, and so does a failed cluster check. Assisted-by: AI coding assistants Signed-off-by: DuskFall <shreyassrini2007@gmail.com>
|
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here. DetailsNeeds approval from an approver in each of these files:Approvers can indicate their approval by writing |
|
No actionable comments were generated in the recent review. Summary
Merge Risk:
|
Description
pre_flight(model=...)fails withSDK_ERRORwhenever Hugging Face can't give a size for the model: no network or an air-gapped cluster,HF_HUB_OFFLINE=1, a 429 or 5xx from the Hub, or a model with no parameter count in its metadata. Since #628, any failed check makespre_flightreturn early, and that includes the estimate.SDK_ERRORalso counts against the circuit breaker, so after 5 callspre_flightis blocked for every caller with "K8s API may be degraded", even though the cluster is fine.This keeps an
SDK_ERRORfrom the estimate inside the report underestimate, as before #628. The compatibility, cluster and runtime checks still come back, and the breaker no longer counts it as a failure. A bad model ID or argument (VALIDATION_ERROR) still fails the whole call, and so does a failed cluster check.Tests:
test_pre_flight_keeps_failed_hub_lookup: the report comes back with the estimate error, and runtimes are still listed.test_pre_flight_hub_outage_does_not_open_breaker: through the server in full and progressive mode, withhuggingface_hub.model_inforaising a connection error, more calls than the breaker threshold and thenpre_flight(). The breaker stays closed.test_pre_flight_cluster_outage_still_opens_breaker: a failed cluster check still opens it.test_pre_flight_propagates_failed_checksno longer covers an estimateSDK_ERROR. Its other cases are unchanged.The first two fail on main.
Related Issue
Fixes #667
Checklist
make test-python)make verify)git commit -s)Testing
make verify,make test-scriptsandmake test-pythonpass on Python 3.10, 3.11 and 3.12 (3223 passed), andmake conformancepasses.End to end against a k3s cluster with the Trainer CRDs, over stdio and HTTP, main vs this branch:
SDK_ERROR5 times, thenCIRCUIT_OPEN, also forpre_flight()estimateholds the errorHF_HUB_OFFLINE=1SDK_ERRORafter the 10 s timeoutexecute_tool)pre_flight()getsCIRCUIT_OPENpre_flight()workspre_flight(model=...)fails and reopens itquantizationornum_workersVALIDATION_ERRORPERMISSION_DENIEDestimate_resourcescalled directly, Hub unreachableSDK_ERRORSame results with the
uv.lockdependencies and with a plainpip install(huggingface-hub 2.5.0).