You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Commit 5e8977f
Browse filesBrowse the repository at this point in the historyBrowse files
Fix services ending when replicas exit with 0 (#4482)
A service whose replicas exited with 0 either had them resubmitted by
scaling or ended with ALL_JOBS_DONE, depending on whether all of them
finished in the same tick. With `stop_criteria: master-done`, any
replica reaching DONE could end the whole service, but only if the run
pipeline saw the job after it left TERMINATING.
- Services never end with ALL_JOBS_DONE. Replicas that exit with 0 are
brought back by scaling, and an all-DONE tick moves the run to
PENDING, so it is resubmitted with a backoff.
- `master-done` applies within a replica: once the master job is DONE
or finishing with DONE_BY_RUNNER, the replica counts as DONE. It has
no effect on single-job service replicas. A worker failing in the
same tick the master finishes no longer fails the run.
Fixes: #4479Fixes: #4481
Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
- For active runs, it derives the run status from the latest job states in priority order:
23
23
1. If any non-retryable failure is present, the run becomes `TERMINATING` with the relevant `RunTerminationReason`.
24
-
2.If `stop_criteria == MASTER_DONE` and the master job is done, the run becomes `TERMINATING` with `ALL_JOBS_DONE`.
25
-
3. Otherwise, if any job is `RUNNING`, the run becomes `RUNNING`.
26
-
4. Otherwise, if any job is `PROVISIONING`or `PULLING`, the run becomes `PROVISIONING`.
27
-
5. Otherwise, if jobs are still waiting for placement or provisioning, the run stays `SUBMITTED`.
28
-
6. Otherwise, if all contributing jobs are `DONE`, the run becomes `TERMINATING` with `ALL_JOBS_DONE`.
29
-
7. Otherwise, if no active replicas remain and the run should be retried, the run becomes `PENDING`.
24
+
2.Otherwise, if any job is `RUNNING`, the run becomes `RUNNING`.
25
+
3. Otherwise, if any job is `PROVISIONING` or `PULLING`, the run becomes `PROVISIONING`.
26
+
4. Otherwise, if jobs are still waiting for placement or provisioning, the run stays `SUBMITTED`.
27
+
5. Otherwise, if all contributing jobs are `DONE`, the run becomes `TERMINATING` with `ALL_JOBS_DONE`.
28
+
6. Otherwise, if no active replicas remain and the run should be retried, the run becomes `PENDING`.
29
+
-`stop_criteria` applies within a replica. With `MASTER_DONE`, once the replica's master job (`job_num == 0`) is `DONE` or `TERMINATING` with `DONE_BY_RUNNER`, the whole replica counts as `DONE`: the other jobs are neither waited for nor retried, and their failures are ignored.
30
30
- Retryable replica failures are handled before the final transition is applied:
31
31
- If a replica fails with a retryable reason while other replicas are still active, `RunPipeline` creates a new `SUBMITTED` submission for that replica and terminates the old jobs in that replica.
32
32
- If all remaining work is retryable, the run ends up in `PENDING`.
@@ -47,6 +47,7 @@ Services' run lifecycle has some modifications:
47
47
- During STEP 1, the service itself is registered on the gateway or the in-server proxy. If the gateway is not accessible or the domain name is taken, submission fails.
48
48
- During STEP 2, active run processing also computes desired replica counts from gateway stats and handles scale-up, scale-down, rolling deployment, and cleanup of removed replica groups.
49
49
- During STEP 2, jobs already marked `SCALED_DOWN` do not contribute to the run status.
50
+
- During STEP 2, a service never ends with `ALL_JOBS_DONE`. A replica that exits with 0 is inactive, so scaling resubmits it regardless of `retry`. If all replicas are `DONE` at once, the run becomes `PENDING` instead and is resubmitted as a whole after the backoff.
50
51
- During STEP 3, a service can stay in `PENDING` when autoscaling currently wants zero replicas.
51
52
- During STEP 5, the terminating phase of `RunPipeline` unregisters the service from the gateway.
0 commit comments