[RayJob] Don't fail a running Ray job when the submitter exits - #5099
Open
1fanwang wants to merge 1 commit into
Open
[RayJob] Don't fail a running Ray job when the submitter exits#50991fanwang wants to merge 1 commit into
1fanwang wants to merge 1 commit into
Conversation
1fanwang
requested review from
MortalHappiness,
andrewsykim,
kevin85421 and
rueian
as code owners
August 7, 2026 00:04
1fanwang
force-pushed
the
fix/submitter-timeout-consult-job-status
branch
2 times, most recently
from
August 7, 2026 01:19
7c42080 to
50c57a2
Compare
5 tasks
1fanwang
force-pushed
the
fix/submitter-timeout-consult-job-status
branch
from
August 7, 2026 02:25
50c57a2 to
34a7ed6
Compare
1fanwang
marked this pull request as draft
August 7, 2026 03:21
1fanwang
marked this pull request as ready for review
August 7, 2026 05:38
1fanwang
force-pushed
the
fix/submitter-timeout-consult-job-status
branch
from
August 7, 2026 05:58
34a7ed6 to
d31576d
Compare
1fanwang
marked this pull request as draft
August 7, 2026 06:39
1fanwang
force-pushed
the
fix/submitter-timeout-consult-job-status
branch
from
August 7, 2026 07:14
d31576d to
247d6fb
Compare
1fanwang
marked this pull request as ready for review
August 7, 2026 07:15
1fanwang
marked this pull request as draft
August 7, 2026 07:45
1fanwang
force-pushed
the
fix/submitter-timeout-consult-job-status
branch
from
August 7, 2026 08:04
247d6fb to
ddf3116
Compare
1fanwang
marked this pull request as ready for review
August 7, 2026 09:25
1fanwang
force-pushed
the
fix/submitter-timeout-consult-job-status
branch
from
August 7, 2026 09:47
ddf3116 to
f01abb6
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit f01abb6. Configure here.
The submitter's exit is treated as evidence that the Ray job should be terminal, but it isn't. `ray job logs --follow` returns 0 whenever the log WebSocket closes with a non-abnormal code, so the submitter can finish under a perfectly healthy job — after printing that the job is still RUNNING. When that happens KubeRay waits 30s, overwrites the accurate RUNNING with a fabricated FAILED, and with shutdownAfterJobFinishes deletes the cluster out from under the driver. The grace period was added for the opposite problem: after a head restart the dashboard reports a status that never resolves, so the RayJob would hang. Both cases reach this code with JobStatus RUNNING, which is why the timeout cannot simply be removed. Ask the cluster instead of guessing. A job status is only current while the node running its driver is alive, so check that node against the dashboard's node list before giving up. Ray already reports driver_node_id on the job; this deserializes it and adds an IsNodeAlive call for the check. The check runs after the job-info poll, where both are available. This compares no timestamps and reads no Pod lifecycle, so it is unaffected by readiness probes flapping, by a sidecar submitter dying, and by whether the head restarted before or after the submitter exited. Addresses ray-project#4921. Related: ray-project#2314. Signed-off-by: 1fanwang <1fannnw@gmail.com>
1fanwang
force-pushed
the
fix/submitter-timeout-consult-job-status
branch
from
August 7, 2026 10:08
f01abb6 to
9f11cf2
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?
KubeRay treats the submitter finishing as evidence the Ray job is terminal. It isn't.
ray job logs --follow, the submitter's last command inK8sJobModeandSidecarMode, returns 0 on any non-abnormal WebSocket close (sdk.py):checkSubmitterFinishedTimeoutAndUpdateStatusIfNeededthen waits 30s, overwritesRUNNINGwithFAILED, and undershutdownAfterJobFinishesdeletes the cluster from under the driver. It also produces the inconsistent status pair in #2314.Ask the cluster instead of guessing
The timeout can't just be removed: #4091 added it for a status that never resolves after a head restart. Both cases arrive with
JobStatus: RUNNING.A job status is only current while the node running its driver is alive. Ray already reports
driver_node_idon the job; this deserializes it and adds anIsNodeAlivecheck against the dashboard's node list:The check moves after the job-info poll, where
jobInfoand the client are already available. It compares no timestamps and reads no Pod lifecycle, so it is unaffected by readiness probes flapping, by a sidecar submitter dying, and by whether the head restarted before or after the submitter exited, earlier revisions got each of those wrong, and Bugbot caught them.Scoped to
RUNNINGon purpose: Ray assignsdriver_node_idwhen it schedules the job's supervisor, so aPENDINGjob has none to check against. Those keep today's behavior rather than being guessed at. An unreachable dashboard returns an error and requeues instead of counting as a dead driver, and ajobInfothat has already gone terminal is left to the normal handling.The e2e test
RayJob has exceed SubmitterFinishedTimeoutasserted the old behaviour; it is rewritten to assert the job survives, and renamed.Related issue number
Addresses #4921. Related: #2314.
Labels
doc-updates-requiredbreaking-changeChecks
Manual test instructions
kind, operator built from this branch,
rayproject/ray:2.55.1.The bug, on unpatched
master. Stock submitter, nothing simulated, kill the head'sDashboardAgentmid-job:Its own last two lines before exiting 0:
One run died 47s into a 240s job; kept alive for inspection, that job printed its completion marker and GCS reported success while the CR said
Failed.Healthy cluster, submitter exits 0, patched. The job outlives the grace period and finishes:
Driver node gone, patched, still fails. Killing the agent degrades the node, so it stops reporting ALIVE and the timeout fires as before:
Same for a head restart, the driver's node is absent from the live set afterwards:
Unit tests