[RayJob]Refactor the sidecar container failure detection logic and extract common functions#4976
Closed
zhuyanhuazhuyanhua wants to merge 0 commit into
Closed
[RayJob]Refactor the sidecar container failure detection logic and extract common functions#4976zhuyanhuazhuyanhua wants to merge 0 commit into
zhuyanhuazhuyanhua wants to merge 0 commit into
Conversation
zhuyanhuazhuyanhua
requested review from
MortalHappiness,
andrewsykim,
kevin85421 and
rueian
as code owners
July 5, 2026 17:01
zhuyanhuazhuyanhua
force-pushed
the
master
branch
from
July 8, 2026 16:25
f2dfdbf to
bb6a02f
Compare
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.
Why are these changes needed?
In
SidecarMode, theray-job-submitterruns as a container inside the head Pod with the head Pod'sRestartPolicyset toNever. If the submitter exits non-zero before the RayCluster reachesReady(e.g. the job fails while workers are still being scheduled), the terminated submitter container keeps the head PodReady=False, soRayCluster.Status.Statenever becomesReady.The RayJob
Initializing -> Runningtransition is gated onRayCluster.Status.State == Ready, and the only submitter-failure detector (checkSubmitterAndUpdateStatusIfNeeded) runs only in theRunningstate. As a result the RayJob is wedged inInitializingforever: it never transitions toFailed,shutdownAfterJobFinishesnever runs, and the autoscaler keeps retrying workers — even though the submitter failure is already observable.This PR detects a terminal submitter failure during
Initializing(SidecarMode) and fails fast. The feature-gate-aware detection (SidecarSubmitterRestart) is extracted intocheckSidecarSubmitterFailedAndUpdateStatusand shared by theInitializingandRunningstates; theInitializingcall skips when the head Pod does not exist yet.Related issue number
Closes #4945 #4946
Checks
Testing:
go build ./controllers/ray/...,go vet ./controllers/ray/,gofumpt -l— cleanTestCheckSidecarSubmitterFailedAndUpdateStatus: submitterTerminatedexit != 0 →Failed/SubmissionFailed; same withJobStatusalreadyFailed→AppFailed; exit 0 → no-op; stillRunning→ no-op;SidecarSubmitterRestartenabled → routes to the restart-count checkgo test ./controllers/ray/ -run 'TestCheckSidecarSubmitterFailedAndUpdateStatus|TestCheckIsRestartCountExceeded'— pass