Repository navigation
Simplify orchestrator exit cleanup via PID-1 wrapper gang JobSet teardown - #2825
Merged
Merged
Conversation
dingying-ai
marked this pull request as ready for review
October 12, 2026 23:30
dingying-ai
requested review from
abheesht17,
hgao327,
jiangyangmu,
lc5211,
s-noghabi,
sizhit2,
tianshub and
wang2yn84
as code owners
October 12, 2026 23:30
Contributor
|
Warning You have reached your daily quota limit. Please wait up to 24 hours and I will start processing your requests again! |
knightwh
approved these changes
Oct 12, 2026
niting
approved these changes
Oct 13, 2026
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.
Summary
Supersedes #2782 with a simpler, zero-Python-dependency teardown mechanism for multi-slice GKE runs:
jobset.cpu.yaml/yaml_generator.py): When--teardown_gang_on_exitis passed alongside--gang_id, the orchestrator container's PID-1 bash wrapper runskubectl delete jobsets.jobset.x-k8s.io -n <namespace> -l scheduling.x-k8s.io/gang-id=<gang-id> --field-selector=metadata.name!=<orch-name> --ignore-not-found=true --wait=falseimmediately afterwait $PID, before exiting with$EXIT_CODE. Because it runs in PID 1 afterwait $PID, it executes on both normal completion (EXIT_CODE=0) and unhandled Python exceptions/crashes (EXIT_CODE!=0), while leaving the orchestrator JobSet itself intact so Kubernetes recordsCompletedvsFailedaccurately.terminationGracePeriodSecondsinjobset.cpu.yamlfrom30to300so_sigtermhas sufficient time to let Python flush logs and run thekubectl deletecall beforeSIGKILL.kubectlinDockerfile: Installs the official standalone/usr/local/bin/kubectlbinary inDockerfileso orchestrator containers havekubectlinPATHout of the box.deepswe_dist/k8s_launcher.shandmath_gsm8k_dist/k8s_launcher.shto pass${GANG_ID:+--teardown_gang_on_exit}instart_orchestrator()wheneverGANG_IDis set.orchestrator.py): Wraps best-effort workercluster.close()in a daemon thread with a 30s timeout so hung gRPC channels to dead/preempted workers cannot block orchestrator exit.Test
pytest tests/experimental/distributed/deployment/yaml_generator_test.py tests/experimental/orchestrator/orchestrator_test.py(32 passed)Qwen/Qwen3-0.6B, two2x2x1TPU v5p slices = 8 chips):dy-pr2825-v2-ok,MAX_STEPS=2): Completed 2 GRPO steps; PID-1 wrapper deleted sibling*-rolland*-trainJobSets in<1sand exited withEXIT_CODE=0(*-orchJobSet markedCompleted).dy-pr2825-v2-err): TriggeredWeightSyncErroron step 1; PID-1 wrapper caught non-zero Python exit, deleted sibling*-rolland*-trainJobSets in0.21s, and exited withEXIT_CODE=1(*-orchJobSet markedFailed, zero orphaned worker pods/slices).Orchestrator PID-1 Teardown Logs (Normal & Error Exit)
Scenario A (
EXIT_CODE=0):Scenario B (
EXIT_CODE=1):