Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[question] Why not update task role's min member to its replicas, but set it to its replicas in creating podgroup? #2792

Closed
lowang-bh opened this issue Apr 15, 2023 · 2 comments · Fixed by #2802
Assignees
Labels
kind/feature Categorizes issue or PR as related to a new feature.

Comments

@lowang-bh
Copy link
Member

I am not sure this is as design or a issue. Can somebody help me to undestand it?

when create new podgroup, if task.MinAvailable == nil, then minTaskMember[task.Name] = task.Replica

minTaskMember[task.Name] = task.Replicas

minTaskMember := map[string]int32{}
for _, task := range job.Spec.Tasks {
      if task.MinAvailable != nil {
	      minTaskMember[task.Name] = *task.MinAvailable
      } else {
	      minTaskMember[task.Name] = task.Replicas
      }
}

But when updating job, it skip to set role's min member when task.MinAvailable == nil

if task.MinAvailable == nil {

	if pg.Spec.MinTaskMember == nil {
		pgShouldUpdate = true
		pg.Spec.MinTaskMember = make(map[string]int32)
	}

	for _, task := range job.Spec.Tasks {
		if task.MinAvailable == nil {
			continue
		}
...
	}

What would you like to be added:

	for _, task := range job.Spec.Tasks {
		cnt := task.Replicas
		if task.MinAvailable != nil {
			cnt = *task.MinAvailable
		} 

		if taskMember, ok := pg.Spec.MinTaskMember[task.Name]; !ok {
			pgShouldUpdate = true
			pg.Spec.MinTaskMember[task.Name] = cnt
		} else {
			if taskMember == cnt{
				continue
			}

			pgShouldUpdate = true
			pg.Spec.MinTaskMember[task.Name] = cnt
		}
	}

Why is this needed:

@lowang-bh lowang-bh added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 15, 2023
@wangyang0616
Copy link
Member

I understand your modification is correct.

@lowang-bh
Copy link
Member Author

/assign

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/feature Categorizes issue or PR as related to a new feature.
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants