Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

add job priority for kube-batch scheduling #141 #45

Closed
wants to merge 2 commits into from

Conversation

YesterdayxD
Copy link

@YesterdayxD YesterdayxD commented Aug 23, 2019

This change is Reviewable

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign richardsliu
You can assign the PR to them by writing /assign @richardsliu in a comment when ready.

The full list of commands accepted by this bot can be found 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

if jc.Config.EnableGangScheduling {
minAvailableReplicas := getTotalReplicas(replicas)
priorityClassName := getPriorityClassName(runPolicy)
//_, err := pc.SyncPodGroup(job, minAvailableReplicas)
Copy link
Contributor

Choose a reason for hiding this comment

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

why keep this ?

Copy link
Author

Choose a reason for hiding this comment

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

I reference the code about EnableGangScheduling of other operators and add the priority‘s’attribute and function.

@@ -188,4 +188,8 @@ type RunPolicy struct {
// job, for example `minAvailable` for gang-scheduling.
type SchedulingPolicy struct {
MinAvailable *int32 `json:"minAvailable,omitempty"`

//add PriorityClassName
Copy link
Member

Choose a reason for hiding this comment

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

We can remove this line

@@ -40,7 +40,7 @@ func (jc *JobController) deletePodsAndServices(runPolicy *apiv1.RunPolicy, job i
}
return nil
}

// TTL means time to live
Copy link
Member

Choose a reason for hiding this comment

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

This line, too.

@@ -299,3 +309,14 @@ func (jc *JobController) cleanupJob(runPolicy *apiv1.RunPolicy, jobStatus apiv1.
jc.WorkQueue.AddRateLimited(key)
return nil
}
func getPriorityClassName(runPolicy *apiv1.RunPolicy) string {
priorityClassName := *runPolicy.SchedulingPolicy.PriorityClassName
Copy link
Member

Choose a reason for hiding this comment

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

Runtime error here

func getTotalReplicas(replicas map[apiv1.ReplicaType]*apiv1.ReplicaSpec) int32 {
jobReplicas := int32(0)
for _, r := range replicas {
jobReplicas += *r.Replicas
Copy link
Member

Choose a reason for hiding this comment

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

I think we should check if r.Replicas is nil here, too.

Copy link
Author

Choose a reason for hiding this comment

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

I got it

@YesterdayxD
Copy link
Author

I try to correct it

@terrytangyuan
Copy link
Member

terrytangyuan commented Aug 23, 2019

Hmm I just asked the author of the other PR in MPI operator to submit the changes here: kubeflow/mpi-operator#141

Are you in the same team? It would be better if you can send a note before submitting the PR to avoid redundant work in the future. Anyways, thanks for your contribution!

@terrytangyuan
Copy link
Member

cc @4everming

@YesterdayxD
Copy link
Author

@terrytangyuan Yes, we are in same team. I will be more careful next time. Thank you for reminding me.
@4everming

@gaocegege
Copy link
Member

@terrytangyuan Since the MPI operator does not use the common operator now, should we keep the similar logic in these two repos?

@terrytangyuan
Copy link
Member

Yes I think it’s fine to do that for now. Though the types like RunPolicy is used in MPI operator so that should be reused.

@gaocegege
Copy link
Member

Yeah, I think so.

BTW @YesterdayxD @4everming

Really appreciate it if you could open an issue to illustrate why we need the change and how to implement it in several operators.

Personally, I know that there is a queue in PodGroup and we can set it to define the priority. And the default value is default. But I think we should have a doc or issue to keep track of the change. Maybe we could cc k82cn@ to request a review, too.

@YesterdayxD
Copy link
Author

ok,I will open an issue about the PR

@k82cn
Copy link
Contributor

k82cn commented Aug 24, 2019

that's great, I'd like to contribute too :)

@4everming
Copy link

Yeah, I think so.

BTW @YesterdayxD @4everming

Really appreciate it if you could open an issue to illustrate why we need the change and how to implement it in several operators.

Personally, I know that there is a queue in PodGroup and we can set it to define the priority. And the default value is default. But I think we should have a doc or issue to keep track of the change. Maybe we could cc k82cn@ to request a review, too.

Sure thing. Thanks a lot.

@gaocegege
Copy link
Member

#46

@4everming and @YesterdayxD are working on a proposal, @ me and k82cn@ if you think it is ready to review.

@terrytangyuan
Copy link
Member

/close

@k8s-ci-robot
Copy link

@terrytangyuan: Closed this PR.

In response to this:

/close

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/test-infra repository.

@terrytangyuan
Copy link
Member

Closing this due to inactivity. Feel free to re-open if this is picked up again.

georgkaleido pushed a commit to georgkaleido/common that referenced this pull request Jun 9, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants