Skip to content

Commit

Permalink
ismaster fix
Browse files Browse the repository at this point in the history
  • Loading branch information
deepanker13 committed Dec 21, 2023
1 parent b938905 commit 17a8c5c
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions pkg/controller.v1/pytorch/pytorchjob_controller.go
Original file line number Diff line number Diff line change
Expand Up @@ -504,6 +504,15 @@ func (r *PyTorchJobReconciler) SetClusterSpec(job interface{}, podTemplate *core
return nil
}

func (r *PyTorchJobReconciler) IsMasterRole(replicas map[kubeflowv1.ReplicaType]*kubeflowv1.ReplicaSpec,
rtype kubeflowv1.ReplicaType, index int) bool {
if _, ok := replicas[kubeflowv1.PyTorchJobReplicaTypeMaster]; ok {
return string(rtype) == strings.ToLower(string(kubeflowv1.PyTorchJobReplicaTypeMaster))
}
// else check if it is worker with index 0
return string(rtype) == strings.ToLower(string(kubeflowv1.PyTorchJobReplicaTypeWorker)) && index == 0
}

func (r *PyTorchJobReconciler) GetDefaultContainerName() string {
return kubeflowv1.PyTorchJobDefaultContainerName
}
Expand All @@ -512,11 +521,6 @@ func (r *PyTorchJobReconciler) GetDefaultContainerPortName() string {
return kubeflowv1.PyTorchJobDefaultPortName
}

func (r *PyTorchJobReconciler) IsMasterRole(replicas map[kubeflowv1.ReplicaType]*kubeflowv1.ReplicaSpec,
rtype kubeflowv1.ReplicaType, index int) bool {
return string(rtype) == string(kubeflowv1.PyTorchJobReplicaTypeMaster)
}

// onOwnerCreateFunc modify creation condition.
func (r *PyTorchJobReconciler) onOwnerCreateFunc() func(event.CreateEvent) bool {
return func(e event.CreateEvent) bool {
Expand Down

0 comments on commit 17a8c5c

Please sign in to comment.