feat: Support running although it is uesless #194
Conversation
/cc @johnugeorge |
@gaocegege Sorry.I missed it. As you are saying, it makes sense to have consistent behavior since PodPolicy is shared now. It doesn't hurt anyways to add them. Please share your thoughts |
Thanks for your comments. I also think Running policy should be avoided in PytorchJob. But we have such case: The users want to stop running pods in pytorch-operator as tf-operator does. And they set the policy to Running. But all pods are deleted since we treat Running as All. Then how about: func (pc *PyTorchController) deletePodsAndServices(job *pyv1.PyTorchJob, pods []*v1.Pod) error {
if len(pods) == 0 {
return nil
}
// Delete nothing when the cleanPodPolicy is None.
if *job.Spec.CleanPodPolicy == common.CleanPodPolicyNone || *job.Spec.CleanPodPolicy == common.CleanPodPolicyRunning {
return nil
} We do not delete all pods, we follow the same behavior as CleanPodPolicyNone |
Looks good to me. It would be better than deleting the pods which adds more confusion. |
Yeah, I think so. I will update it |
Signed-off-by: Ce Gao <gaoce@caicloud.io>
/assign @johnugeorge |
/lgtm |
/approve |
[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 |
We are using common.CleanPodPolicy now in pytorchjob, and if users set the policy to running, we will delete all pods and services. I think the behaviour is not consistent with tfjob. In pytorchjob, maybe we could support running, which does not delete anything just like None, to be user-friendly.
WDYT @johnugeorge
One of our users does not know we do not support running, and use it. Then he found that the pods are deleted although they are not running
Signed-off-by: Ce Gao gaoce@caicloud.io