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

fix(job_test) test case should not include worker service #231

Merged
merged 2 commits into from
Dec 11, 2019

Conversation

leileiwan
Copy link
Contributor

hi,
the code fix the issue #228

@k8s-ci-robot
Copy link

Hi @leileiwan. Thanks for your PR.

I'm waiting for a kubeflow member to verify that this patch is reasonable to test. If it is, they should reply with /ok-to-test on its own line. Until that is done, I will not automatically test new commits in this PR, but the usual testing commands by org members will still work. Regular contributors should join the org to skip this step.

Once the patch is verified, the new status will be reflected by the ok-to-test label.

I understand the commands that are listed here.

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.

@leileiwan
Copy link
Contributor Author

/assign @richardsliu

@johnugeorge
Copy link
Member

/ok-to-test

@coveralls
Copy link

Coverage Status

Coverage remained the same at 85.345% when pulling 22ea5ea on leileiwan:master into 5522f91 on kubeflow:master.

@johnugeorge
Copy link
Member

can you do a rebase?

Generate Kubeflow PyTorchJob SDK (kubeflow#227)
@@ -200,7 +201,9 @@ func (f *FakeServiceControl) CreateServicesWithControllerRef(namespace string, s
func (f *FakeServiceControl) DeleteService(namespace string, serviceID string, object runtime.Object) error {
f.Lock()
defer f.Unlock()
f.DeleteServiceName = append(f.DeleteServiceName, serviceID)
if strings.Contains(serviceID, "master"){
Copy link
Member

Choose a reason for hiding this comment

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

It's a little hack. I am wondering if we need it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Because function "deletePodsAndServices" will delete all the services of pod, so if we don not change the function "deletePodsAndServices"(only delete the master service), maybe it's difficult to pass the test case without change the function DeleteService(FakeServiceControl)

func (pc *PyTorchController) deletePodsAndServices(job *pyv1.PyTorchJob, pods []*v1.Pod) error {
	if len(pods) == 0 {
		return nil
	}

	// Delete nothing when the cleanPodPolicy is None or Running.
	if *job.Spec.CleanPodPolicy == common.CleanPodPolicyNone ||
		*job.Spec.CleanPodPolicy == common.CleanPodPolicyRunning {
		return nil
	}

	for _, pod := range pods {
		if err := pc.PodControl.DeletePod(pod.Namespace, pod.Name, job); err != nil {
			return err
		}
		// Pod and service have the same name, thus the service could be deleted using pod's name.
		if err := pc.ServiceControl.DeleteService(pod.Namespace, pod.Name, job); err != nil {
			return err
		}
	}
	return nil
}

Copy link
Member

Choose a reason for hiding this comment

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

Gotcha. SGTM. I think it is a potential issue in our code base. We can have another PR to avoid deleting unexisting worker services.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yes, it will be better to avoid deleting unexisting worker services.

Copy link
Member

Choose a reason for hiding this comment

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

Can you take this cleanup in a separate PR?

Copy link
Member

Choose a reason for hiding this comment

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

@leileiwan can you create an issue to track this

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@gaocegege
Copy link
Member

/lgtm

Thanks for your contribution! 🎉 👍

Waiting for johnu's approval.

@johnugeorge
Copy link
Member

Thanks for your contribution.
/approve

@k8s-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: johnugeorge

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

@k8s-ci-robot k8s-ci-robot merged commit c05874c into kubeflow:master Dec 11, 2019
leileiwan added a commit to leileiwan/pytorch-operator that referenced this pull request Dec 11, 2019
fix(job_test) test case should not include worker service (kubeflow#231)
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.

6 participants