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

It will be better to avoid deleting unexisting worker services. #232

Closed
leileiwan opened this issue Dec 11, 2019 · 1 comment
Closed

It will be better to avoid deleting unexisting worker services. #232

leileiwan opened this issue Dec 11, 2019 · 1 comment

Comments

@leileiwan
Copy link
Contributor

hi,
In the function “ deletePodsAndServices”,we clean the services by delete all the services of pod including the worker pod. it will be better to avoid deleting unexisting worker services.

reference:

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
}
@gaocegege
Copy link
Member

/kind feature

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants