Repository navigation
fix: PodsReady for SparkApplication framework - #11676
Conversation
✅ Deploy Preview for kubernetes-sigs-kueue canceled.
|
|
Welcome @hahahaheihei! |
|
Hi @hahahaheihei. Thanks for your PR. I'm waiting for a kubernetes-sigs member to verify that this patch is reasonable to test. If it is, they should reply with Regular contributors should join the org to skip this step. Once the patch is verified, the new status will be reflected by the I understand the commands that are listed here. DetailsInstructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
/ok-to-test |
|
Please add the release-note block |
|
/retest |
|
cfa4c1f to
59044ac
Compare
| sparkcommon.LabelSparkRole: sparkcommon.SparkRoleDriver, | ||
| }, | ||
| ); err == nil && len(driverList.Items) > 0 { | ||
| driverKeys := make([]client.ObjectKey, 0, len(driverList.Items)) |
There was a problem hiding this comment.
do not silence errors, propagate up
There was a problem hiding this comment.
You're right; thank you for your suggestion.
|
/cc @everpeace |
| _ = wait.PollUntilContextTimeout(ctx, 200*time.Millisecond, 5*time.Second, true, func(ctx context.Context) (bool, error) { | ||
| for _, key := range driverKeys { | ||
| var p corev1.Pod | ||
| err := c.Get(ctx, key, &p) | ||
| if err == nil { | ||
| return false, nil | ||
| } | ||
| if !apierrors.IsNotFound(err) { | ||
| return false, err | ||
| } | ||
| } | ||
| return true, nil | ||
| }) |
There was a problem hiding this comment.
The periodic poll is not a good pattern, and is potentially racy.
I'm wondering - why not just return error if there are any pods which are not terminating? Then the job reconciler should re-enter Stop, and kill some more pods
There was a problem hiding this comment.
in my test ,we shoul wait for driver pod be cleaned,then kill pending executor pod ,otherwise, the driver pod may occasionally be re-launched before being cleaned, and when a new driver pod starts up, it will launch a new executor pod as well. if return err
if ptr.Deref(j.Spec.Suspend, false) {
return false, nil
}
this code ,will never kill executor pod
There was a problem hiding this comment.
Perhaps a more elegant implementation would be to delegate both the executor cleanup and driver cleanup to the Spark-operator, while the kueue only needs to manage the suspend operation at critical moments. @mimowo
There was a problem hiding this comment.
Oh yes, this is how the integration k8s job, JobSet or other CRDs work - we just flip the suspend, and wait for termination in isActive
There was a problem hiding this comment.
I have submitted the corresponding issue to the Spark community. kubeflow/spark-operator#2961
There was a problem hiding this comment.
yeah but still waiting 5s seems arbitrary and racy im wondering if we can fix it better even if the code is in kueue
There was a problem hiding this comment.
I have removed the stop-related logic. I believe that with proper configuration of ownerReferences, driver pod and executor pod should be cascaded for deletion.
There was a problem hiding this comment.
sgtm it would be great if you can confirm this is working well on a live cluster, plus let's adjust the release note.
59044ac to
4ebed80
Compare
| func (j *SparkApplication) PodsReady(ctx context.Context, _ client.Client) bool { | ||
| return j.Status.AppState.State == sparkv1beta2.ApplicationStateRunning | ||
| // Driver must be running. | ||
| if j.Status.AppState.State != sparkv1beta2.ApplicationStateRunning { |
There was a problem hiding this comment.
Could you add a unit test for the Reconcile, IIUC it will call PodsReady
There was a problem hiding this comment.
sure ,i have added some unit test
Signed-off-by: hahahaheihei <1475660997@qq.com>
4ebed80 to
cad24f4
Compare
mimowo
left a comment
There was a problem hiding this comment.
/lgtm
/approve
Thank you for bugfixing the integration 👍
/cherrypick release-0.17
|
LGTM label has been added. DetailsGit tree hash: 26c347144f78cb46df301ec9f27daa32b92c9631 |
|
[APPROVALNOTIFIER] This PR is APPROVED This pull-request has been approved by: hahahaheihei, mimowo The full list of commands accepted by this bot can be found here. The pull request process is described here DetailsNeeds approval from an approver in each of these files:
Approvers can indicate their approval by writing |
|
/cherrypick release-0.17 |
|
@mimowo: #11676 failed to apply on top of branch "release-0.17": DetailsIn response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository. |
|
@hahahaheihei please prepare the cherrypick if you would like the fix to be included in patch release |
sure , once i resolve the conflict , i will submit a new pr |
|
Awesome. we are planning the patch releases today, around 11 am Polish time. Otherwise it will go to the next patch release, in two weeks. |
What type of PR is this?
/kind bug
What this PR does / why we need it:
this pr fixed sparkapplication can't requeue when driver pod or executor unready timeout
Which issue(s) this PR fixes:
Fixes #11675
Special notes for your reviewer:
Does this PR introduce a user-facing change?