Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix UpdateJobStatusInApiServer when gang-scheduling is enabled #1549

Merged
merged 1 commit into from
Mar 17, 2022

Conversation

zw0610
Copy link
Member

@zw0610 zw0610 commented Mar 17, 2022

When --enable-gang-scheduling is enabled, for jobs with PodGroup in pending phase, the operator will update the JobStatus with only its LastReconcileTime being changed. That means the jobStatus.replicaStatues could be nil when being pushed to the APIServer, triggering an error message.
bf662adb42f5f52efacb01cb4e00ce3a

This PR add a fix procedure for all controllers to give an empty value for jobStatus.replicaStatues if nil.

@coveralls
Copy link

Pull Request Test Coverage Report for Build 1996436561

  • 5 of 15 (33.33%) changed or added relevant lines in 5 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage decreased (-0.008%) to 36.815%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/controller.v1/mpi/mpijob_controller.go 1 3 33.33%
pkg/controller.v1/pytorch/pytorchjob_controller.go 1 3 33.33%
pkg/controller.v1/mxnet/mxjob_controller.go 0 3 0.0%
pkg/controller.v1/xgboost/xgboostjob_controller.go 0 3 0.0%
Totals Coverage Status
Change from base Build 1972516378: -0.008%
Covered Lines: 2277
Relevant Lines: 6185

💛 - Coveralls

Copy link
Member

@gaocegege gaocegege left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/lgtm

@Jeffwan
Copy link
Member

Jeffwan commented Mar 17, 2022

That's a nice catch.

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: gaocegege, zw0610

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@google-oss-prow google-oss-prow bot merged commit 6e42040 into kubeflow:master Mar 17, 2022
@Jeffwan
Copy link
Member

Jeffwan commented Mar 17, 2022

I have one comment on this. Since we don't use webhook, it's a little bit hard to mutate obj prior reconciliation.

We do have similar cases like below. The tricky thing is we should invoke these method in the right place. In this cases, it definitely operate object before initialization which bring the problems.

func setRestartPolicy(podTemplateSpec *corev1.PodTemplateSpec, spec *commonv1.ReplicaSpec) {

func initializeReplicaStatuses(jobStatus *commonv1.JobStatus, rtype commonv1.ReplicaType) {
if jobStatus.ReplicaStatuses == nil {
jobStatus.ReplicaStatuses = make(map[commonv1.ReplicaType]*commonv1.ReplicaStatus)
}
jobStatus.ReplicaStatuses[rtype] = &commonv1.ReplicaStatus{}
}

@gaocegege
Copy link
Member

Should we involve a webhook for the operator?

@johnugeorge
Copy link
Member

Isn't this to be handled by a webhook?

@zw0610 zw0610 deleted the fix-jobstatus-update branch June 20, 2022 04:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants