Skip to content

Commit

Permalink
use raycluster app's name as podgroup name key word (ray-project#1446)
Browse files Browse the repository at this point in the history
use raycluster app's name as podgroup name key word
  • Loading branch information
lowang-bh authored and kevin85421 committed Oct 17, 2023
1 parent 6645ac2 commit ed95a7b
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,12 +65,12 @@ func (v *VolcanoBatchScheduler) DoBatchSchedulingOnSubmission(app *rayv1alpha1.R
return nil
}

func (v *VolcanoBatchScheduler) getAppPodGroupName(app *rayv1alpha1.RayCluster) string {
func getAppPodGroupName(app *rayv1alpha1.RayCluster) string {
return fmt.Sprintf("ray-%s-pg", app.Name)
}

func (v *VolcanoBatchScheduler) syncPodGroup(app *rayv1alpha1.RayCluster, size int32, totalResource corev1.ResourceList) error {
podGroupName := v.getAppPodGroupName(app)
podGroupName := getAppPodGroupName(app)
if pg, err := v.volcanoClient.SchedulingV1beta1().PodGroups(app.Namespace).Get(context.TODO(), podGroupName, metav1.GetOptions{}); err != nil {
if !errors.IsNotFound(err) {
return err
Expand Down Expand Up @@ -138,7 +138,7 @@ func createPodGroup(
}

func (v *VolcanoBatchScheduler) AddMetadataToPod(app *rayv1alpha1.RayCluster, pod *corev1.Pod) {
pod.Annotations[v1beta1.KubeGroupNameAnnotationKey] = v.getAppPodGroupName(app)
pod.Annotations[v1beta1.KubeGroupNameAnnotationKey] = getAppPodGroupName(app)
if queue, ok := app.ObjectMeta.Labels[QueueNameLabelKey]; ok {
pod.Labels[QueueNameLabelKey] = queue
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ func TestCreatePodGroup(t *testing.T) {

minMember := utils.CalculateDesiredReplicas(&cluster) + *cluster.Spec.HeadGroupSpec.Replicas
totalResource := utils.CalculateDesiredResources(&cluster)
pg := createPodGroup(&cluster, cluster.ClusterName, minMember, totalResource)
pg := createPodGroup(&cluster, getAppPodGroupName(&cluster), minMember, totalResource)

a.Equal(cluster.Namespace, pg.Namespace)

Expand Down

0 comments on commit ed95a7b

Please sign in to comment.