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

feat: Add success policy #1506

Closed
wants to merge 6 commits into from
Closed

feat: Add success policy #1506

wants to merge 6 commits into from

Conversation

gaocegege
Copy link
Member

Signed-off-by: cegao ce.gao@outlook.com

What this PR does / why we need it:

Which issue(s) this PR fixes (optional, in Fixes #<issue number>, #<issue number>, ... format, will close the issue(s) when PR gets merged):
Fixes #

Checklist:

  • Docs included if any changes are user facing

Signed-off-by: cegao <ce.gao@outlook.com>
@gaocegege
Copy link
Member Author

/hold

Signed-off-by: cegao <ce.gao@outlook.com>
@gaocegege
Copy link
Member Author

It is blocked by kubeflow/common#181

Signed-off-by: cegao <ce.gao@outlook.com>
Signed-off-by: cegao <ce.gao@outlook.com>
@coveralls
Copy link

Pull Request Test Coverage Report for Build 1562410664

  • 32 of 71 (45.07%) changed or added relevant lines in 5 files are covered.
  • 16 unchanged lines in 3 files lost coverage.
  • Overall coverage increased (+0.04%) to 27.792%

Changes Missing Coverage Covered Lines Changed/Added Lines %
pkg/apis/pytorch/v1/zz_generated.deepcopy.go 0 5 0.0%
pkg/controller.v1/tensorflow/tfjob_controller.go 0 6 0.0%
pkg/apis/pytorch/v1/defaults.go 0 7 0.0%
pkg/apis/pytorch/v1/openapi_generated.go 0 7 0.0%
pkg/controller.v1/pytorch/pytorchjob_controller.go 32 46 69.57%
Files with Coverage Reduction New Missed Lines %
pkg/apis/pytorch/v1/defaults.go 2 19.75%
pkg/controller.v1/mpi/mpijob_controller.go 5 75.41%
pkg/controller.v1/pytorch/pytorchjob_controller.go 9 62.53%
Totals Coverage Status
Change from base Build 1545960757: 0.04%
Covered Lines: 1712
Relevant Lines: 6160

💛 - Coveralls

Copy link
Member

@terrytangyuan terrytangyuan left a comment

Choose a reason for hiding this comment

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

LGTM. Pending approval from the PR in kubeflow/common.

@google-oss-prow
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

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

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:
  • OWNERS [gaocegege,terrytangyuan]

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

@gaocegege
Copy link
Member Author

/retest

@gaocegege
Copy link
Member Author

/hold cancel

Copy link
Member Author

@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.

We decided not to add the successpolicy into the common since we may move to SuccessCondition in the future. Thus we just implement it in PyTorch.Spec and TF.Spec.

/cc @terrytangyuan

// Leave a succeeded condition for the following two cases:
// 1. If default success policy is used and worker 0 has completed.
// 2. If `SuccessPolicyAllWorkers` success policy is used and all workers are succeeded.
if expected == 0 || (worker0Completed && *pytorchjob.Spec.SuccessPolicy != pytorchv1.SuccessPolicyAllWorkers) {
Copy link
Member

Choose a reason for hiding this comment

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

L387 might take a bit of time to understand. Maybe it's because the order of the two conditions are not arranged as the comment lists.

Copy link
Member Author

Choose a reason for hiding this comment

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

The comments and conditions are copied from TF. I will refine it soon.

if !ok {
return true, nil
}
podSlices, err := p.getPodSlices(job,
Copy link
Member

Choose a reason for hiding this comment

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

I understand the slice approach definitely works. But what is the point to create a the getPodSlices method while all we need is just the worker pod with index=0? And what kind of disadvantages will it have to use Get function or List with label selector to catch worker0 pod?

Copy link
Member Author

Choose a reason for hiding this comment

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

It is to keep consistency with TF controller. The code is copied from it.

@@ -58,3 +58,15 @@ func GetSchedulerName(replicas map[commonv1.ReplicaType]*commonv1.ReplicaSpec) s
}
return ""
}

// GetContainerExitCode gets the container exit code from the given pod.
func GetContainerExitCode(pod *corev1.Pod, name string) int32 {
Copy link
Member

Choose a reason for hiding this comment

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

name refers the containerName?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes.

@@ -26,6 +27,7 @@ import (
commonutil "github.com/kubeflow/common/pkg/util"
"github.com/sirupsen/logrus"
corev1 "k8s.io/api/core/v1"
v1 "k8s.io/api/core/v1"
Copy link
Member

Choose a reason for hiding this comment

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

duplicate import

Copy link
Member Author

Choose a reason for hiding this comment

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

Thanks for the comment.

Signed-off-by: cegao <ce.gao@outlook.com>
@gaocegege
Copy link
Member Author

/assign @zw0610

Signed-off-by: cegao <ce.gao@outlook.com>
@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot closed this Apr 27, 2022
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.

None yet

5 participants