Repository navigation
fix(job): default --pathways-max-slice-restarts to 0 when --pathways-elastic-slices is 0 - #6528
Conversation
…elastic-slices is 0 When --pathways-elastic-slices is 0 (non-elastic / rigid training), a single preempted or failed TPU worker pod cannot rejoin an already running slice in-place without tearing down and recreating the slice together. Previously, --pathways-max-slice-restarts unconditionally defaulted to 4000, setting backoffLimitPerIndex=4000 and backoffLimit=4000*nodesPerSlice on the worker Job even when --pathways-elastic-slices was 0, which caused replacement worker pods to crash-loop instead of failing the worker Job and triggering the JobSet failurePolicy (--restarts). Default --pathways-max-slice-restarts to 0 when --pathways-elastic-slices is 0, and to 4000 when --pathways-elastic-slices > 0 (unless --pathways-max-slice-restarts is explicitly specified). Also validate that --pathways-elastic-slices and --pathways-max-slice-restarts are non-negative and reject explicit --pathways-* flags when --pathways is omitted.
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request modifies the default behavior of the --pathways-max-slice-restarts flag to better support non-elastic (rigid) training jobs. Previously, a default value of 4000 prevented non-elastic jobs from entering a failed state when a worker pod failed, as the system would repeatedly attempt to restart the pod in-place. The changes introduce a conditional default that sets the restart limit to 0 for non-elastic jobs, while maintaining the existing behavior for elastic jobs, alongside stricter flag validation and updated documentation. Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize the Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counterproductive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
There was a problem hiding this comment.
Code Review
This pull request updates the default behavior of the '--pathways-max-slice-restarts' flag to dynamically default to 0 when '--pathways-elastic-slices' is 0, and 4000 when '--pathways-elastic-slices' is greater than 0. It also adds validation to ensure these flags are non-negative and updates the associated tests and documentation. The feedback suggests a minor improvement in 'hasChangedPathwaysFlags' to use 'cmd.Flags().Visit' instead of 'VisitAll' for more idiomatic and efficient flag iteration.
|
Defaulting A few things worth addressing before merge:
backoffLimit: {{.WorkerBackoffLimit}}
backoffLimitPerIndex: {{.WorkerBackoffLimitPerIndex}}
podReplacementPolicy: Failed
maxFailedIndexes: 0
template:
spec:
restartPolicy: OnFailureIn Kubernetes Indexed Jobs, {{- if eq .WorkerBackoffLimitPerIndex 0 }}
restartPolicy: Never
{{- else }}
restartPolicy: OnFailure
{{- end }}
if pathways.ElasticSlices > 0 && !cmd.Flags().Changed("pathways-max-slice-restarts") {
pathways.MaxSliceRestarts = defaultElasticMaxSliceRestarts
}running |
…nd default headless to 4000
|
Thanks for the thorough review, @agrawalkhushi18! Addressed both points in 9448434:
|
agrawalkhushi18
left a comment
There was a problem hiding this comment.
Thanks for addressing the comments, LGTM.
636e03d
into
GoogleCloudPlatform:develop
Summary
When
--pathways-elastic-slicesis0(non-elastic / rigid training), a single failed or preempted TPU worker pod cannot recover by restarting in-place while the rest of the slice continues running; the entire slice (andJobSet) must be torn down and recreated together so all workers re-handshake with the Pathways resource manager.Previously,
--pathways-max-slice-restartsunconditionally defaulted to4000, renderingbackoffLimitPerIndex: 4000andbackoffLimit: 4000 * nodesPerSliceon the workerJobeven when--pathways-elastic-sliceswas0. On a non-elastic job, a preempted worker pod was replaced in-place up to 4,000 times (DEADLINE_EXCEEDED: Worker failed to join a slice within 15m), preventing the workerJobfrom entering theFailedstate and preventing theJobSetfailurePolicy(--restarts) from triggering.Changes
cmd/job/submit.go:--pathways-max-slice-restartsto0, and defaultpathways.MaxSliceRestartsto4000(defaultElasticMaxSliceRestarts) whenpathways.ElasticSlices > 0and--pathways-max-slice-restartswas not explicitly passed.--pathways-elastic-slicesand--pathways-max-slice-restartsare non-negative (>= 0).hasChangedPathwaysFlags(cmd)so passing--pathways-max-slice-restarts 0or--pathways-elastic-slices 0without--pathwaysstill returnspathways flags specified but --pathways flag is missing.cmd/job/submit_test.go:--pathways-max-slice-restartsvalues across--pathways-elastic-slices == 0and> 0, negative flag values, and--pathways-*flags passed with0without--pathways.pkg/orchestrator/orchestrator.go,pkg/orchestrator/gke/manifest_generator_test.go,docs/gcluster_job_guide.md:0when--pathways-elastic-slicesis0, or4000when--pathways-elastic-slices > 0).Testing
KUBECONFIG=/dev/null go test -race -count=1 ./cmd/job/... ./pkg/orchestrator/...pre-commit run --files cmd/job/submit.go cmd/job/submit_test.go pkg/orchestrator/orchestrator.go pkg/orchestrator/gke/manifest_generator_test.go docs/gcluster_job_guide.md