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

refine arguments of ControllerInterface.UpdateJobStatus #35

Merged
merged 4 commits into from
May 15, 2019

Conversation

sperlingxx
Copy link
Member

@sperlingxx sperlingxx commented May 7, 2019

Move UpdateJobStatus out of ReconcilePods loop, and remove bool arg(restart) which can be inferred from replicas.


This change is Reviewable

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.

Cannot you obtain this information by iterating through the replicas map?

@sperlingxx
Copy link
Member Author

Cannot you obtain this information by iterating through the replicas map?

for rtype, spec := range replicas {
     err = jc.ReconcilePods(metaObject, &jobStatus, pods, rtype, spec, replicasStatus, replicas)

Because UpdateJobStatus is called in jc.ReconcilePods, which is wrapped by replicas map iteraton.

@terrytangyuan
Copy link
Member

Sure but I mean in your actual implementation of UpdateJobStatus, you can obtain the types and specs by iterating through the map, right?

@sperlingxx
Copy link
Member Author

Yes, but I think, we need to know specific ReplicaType in UpdateJobStatus , because this method will be called for each ReplicaType .

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.

Oh I see. That makes sense. cc'ing others here to double check as well.
/lgtm
/cc @gaocegege @johnugeorge @jian-he @richardsliu

@jian-he
Copy link
Contributor

jian-he commented May 7, 2019

I think the implementation can still be that , loop over the "rtype, replicas" and based on each type, set the job status accordingly.

Also, could this updateJobStatus call be moved out from this reconcilePods method and placed after the for loop, here. This way, it can also be merged with the UpdateJobStatusInApiServer interface.

@sperlingxx
Copy link
Member Author

I think the implementation can still be that , loop over the "rtype, replicas" and based on each type, set the job status accordingly.

Also, could this updateJobStatus call be moved out from this reconcilePods method and placed after the for loop, here. This way, it can also be merged with the UpdateJobStatusInApiServer interface.

I agreed with you.

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.

Thanks for your contribution

Generally, LGTM

@gaocegege
Copy link
Member

Please fix the test failures

@sperlingxx
Copy link
Member Author

Please fix the test failures

Done

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.

@johnugeorge
Copy link
Member

/lgtm

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.

Some questions on your new changes.

@@ -301,7 +301,6 @@ func (jc *JobController) ReconcilePods(
return err
}
numReplicas := int(*spec.Replicas)
restart := false
Copy link
Member

Choose a reason for hiding this comment

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

Why removing this?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because restart or not can be inferred from replicas.

job_controller/test_job_controller.go Outdated Show resolved Hide resolved
@k8s-ci-robot k8s-ci-robot removed the lgtm label May 9, 2019
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

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.

Okay sounds good. Thanks.
/approve

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: 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:

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

@richardsliu richardsliu merged commit 4eb5c57 into kubeflow:master May 15, 2019
georgkaleido pushed a commit to georgkaleido/common that referenced this pull request Jun 9, 2022
Co-authored-by: Paul Angerer <dabauxi@users.noreply.github.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants