fix(jobs): Fix pause/resume checks in kube jobs#494
Open
matthewgrossman wants to merge 1 commit into
Open
Conversation
Signed-off-by: Matthew Grossman <mgrossman@nvidia.com>
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Path: .coderabbit.yaml Review profile: CHILL Plan: Enterprise Run ID: 📒 Files selected for processing (3)
📝 WalkthroughWalkthroughKubernetes job status mapping now checks suspended/cancelling before errored pods. Regression tests cover suspended, pausing, and cancelling jobs with errored pods. Two pause-related E2E tests are re-enabled with shorter step sleeps. ChangesKubernetes pause and cancel handling
Suggested reviewers
🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Contributor
|
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
Fixes AIRCORE-853: Job pause/resume races with errored-pod detection in the K8s reconciler.
When a K8s Job is suspended (paused), Kubernetes kills running pods via SIGTERM. The reconciler's
sync_stepwas checking for errored pods before checking if the job was suspended. The terminated pod (exit code 137 from SIGTERM) was misclassified as an error, causing the job to transition toerrorinstead ofpaused.Root cause: In
kubernetes_job.py, theif errored_pods:check had priority over theif is_suspended:check. The same race existed for cancellation.Fix: Moved the
is_suspendedandis_cancellingchecks before theerrored_podscheck. Pods killed during suspension or cancellation are expected — they must not cause the reconciler to report ERROR.Changes
services/core/jobs/.../kubernetes_job.py— Reorderedsync_stepto check suspended/cancelling state before errored podsservices/core/jobs/tests/.../test_kubernetes_backend.py— Added 3 regression tests:test_sync_job_paused_with_errored_pods_from_sigterm— suspended + errored pod → PAUSEDtest_sync_job_pausing_with_errored_pods_from_sigterm— suspended + mix of running/errored → PAUSINGtest_sync_job_cancelling_with_errored_pods— cancelling + errored pod → CANCELLEDe2e/test_jobs.py— Removed@pytest.mark.skip(reason="AIRCORE-853")fromtest_job_pause_resumeandtest_job_pause_and_cancel; reducedsleep 300→sleep 30so tests complete within the default 120s timeoutTest plan
test_kubernetes_backend.pypasstest_job_pause_resumee2e passes on minikube (3/3 consecutive runs, no flakes)test_job_pause_and_cancele2e passes on minikube (3/3 consecutive runs, no flakes)Summary by CodeRabbit
Bug Fixes
Tests