-
Notifications
You must be signed in to change notification settings - Fork 697
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
support successPolicy and failurePolicy
Signed-off-by: qiankunli <[email protected]> run codegen Signed-off-by: qiankunli <[email protected]> support watch pg and preemptable label Signed-off-by: qiankunli <[email protected]> fix test case Signed-off-by: qiankunli <[email protected]> fix test case Signed-off-by: qiankunli <[email protected]> fix test case Signed-off-by: qiankunli <[email protected]> refactor Signed-off-by: qiankunli <[email protected]> fix make Signed-off-by: qiankunli <[email protected]> fix test Signed-off-by: qiankunli <[email protected]> add corev1 schema Signed-off-by: qiankunli <[email protected]> add podgroups crd Signed-off-by: qiankunli <[email protected]> remove watch podgroups Signed-off-by: qiankunli <[email protected]>
- Loading branch information
Showing
9 changed files
with
166 additions
and
7 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
package pytorch | ||
|
||
import ( | ||
"fmt" | ||
"strconv" | ||
"strings" | ||
|
||
pytorchv1 "github.com/kubeflow/training-operator/pkg/apis/pytorch/v1" | ||
corev1 "k8s.io/api/core/v1" | ||
volcanov1beta1 "volcano.sh/apis/pkg/apis/scheduling/v1beta1" | ||
) | ||
|
||
func setPodLabel(obj interface{}, podTemplateSpec *corev1.PodTemplateSpec, rtype, index string) error { | ||
pytorchjob, ok := obj.(*pytorchv1.PyTorchJob) | ||
if !ok { | ||
return fmt.Errorf("%+v is not a type of PyTorchJob", obj) | ||
} | ||
if len(podTemplateSpec.Labels) == 0 { | ||
podTemplateSpec.Labels = make(map[string]string) | ||
} | ||
if pytorchjob.Spec.PyTorchReplicaSpecs[pytorchv1.PyTorchReplicaTypeMaster] != nil { | ||
if rtype == strings.ToLower(string(pytorchv1.PyTorchReplicaTypeMaster)) { | ||
podTemplateSpec.Labels[volcanov1beta1.PodPreemptable] = "false" | ||
} else { | ||
podTemplateSpec.Labels[volcanov1beta1.PodPreemptable] = "true" | ||
} | ||
} else { | ||
// If the master is null, then we need to set the volcano.sh/preemptable = false to make sure that work0 can not be preempted | ||
rank, err := strconv.Atoi(index) | ||
if err != nil { | ||
return err | ||
} | ||
if rank == 0 { | ||
podTemplateSpec.Labels[volcanov1beta1.PodPreemptable] = "false" | ||
} else { | ||
podTemplateSpec.Labels[volcanov1beta1.PodPreemptable] = "true" | ||
} | ||
} | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters