-
Notifications
You must be signed in to change notification settings - Fork 970
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
Add webhook mutate and controller actions and test case for minAvailable #2896
base: master
Are you sure you want to change the base?
Add webhook mutate and controller actions and test case for minAvailable #2896
Conversation
how about put the podtemplate/pod genaration in a function so that there are fewer code lines? |
I have updated it |
e53bc7e
to
8cc60c0
Compare
Sorry, I don't understand the purpose of this pr and the description in the issue. Can you describe in more detail, is this PR to fix some bugs, or to enhance some functions? |
Sorry, I may not have made it clear. This is an optimization; I want to enhance the minAvailable function. As you know, there is a minavailable attribute in the task, and the job.spec also has the minavailable attribute. I think users only need to write task.minavailable , Volcano's webhook calculates job.spec.minavailable; on the other hand, I think there are bugs in the here of code that generate the pod group, especially the dependson task.
It first calculates the resources of job.Spec.MinAvailable jobs with high priority. I think this is wrong in many cases, such as dependsOn task, or multi-task jobs with equal Priority levels. If job.Spec.MinAvailable < sum(tasks .MinAvailable), he will randomly calculate the minimum resource. I think I'm going to write a detailed design document。 |
I probably see what you mean, thanks for the suggestion, and you are right. |
I know this is a very complicated issue, I may give a suggestion, the modification still requires the overall evaluation of the volcano team, and I will provide a design document. give me some time. |
8cc60c0
to
6fdadb3
Compare
This problem is difficult. I wrote a design document, which is currently in Chinese and can be changed to English later. If you have time, we can discuss in detail |
issue #2921 |
Thanks for your design docs, I will read it later. |
先用中文沟通了,我看了下文档,大致有下面几个问题,如果能更新下设计文档或者做出一些说明就更好了。 哪些设计是已有的,哪些是新加的,这个最好写清楚
这个的目的是什么
如何预留资源?例如master先运行,worker后运行,如何保证master运行后,worker的资源不被抢走。如何兼容多调度器场景?例如在volcano做了资源预留,但是k8s原生调度器把剩余资源抢走了
这里不应该覆盖,即,仅设置job.minAvailable不设置task.minAvailable时,则应该按照job.minAvailable的设置为主,若job.minAvailable和task.minAvailable都未设置时,则job.minAvailable=sum(tasks.replaces) |
issue #2944 |
I think it should consider issue #2921 together. We need to discard this feature deeply. Nowadays there is nobady knows the design perpose which is introduced by @shinytang6 in PR #1459. I read the code and find some problems that the code logic is not self-consistent. 我觉得我们需要深度讨论一下这个功能,issue #2921 记录了需要考虑到的情况,包括目前已有的逻辑和还缺少的,自从PR#1459引入任务级别的minAvaiable之后,代码逻辑不再完备。 |
Signed-off-by: Ren <[email protected]>
6fdadb3
to
b955463
Compare
Signed-off-by: Ren <[email protected]>
Yeah, at first I thought it was a small bug, but I found some logic issues with both the controller and the scheduler, and like you said, we need to discuss this feature. |
I modified the design document, help me review it, thank you |
Signed-off-by: Ren <[email protected]>
b09ae2e
to
ab0c01a
Compare
200327b
to
ab0c01a
Compare
Signed-off-by: Ren <[email protected]>
@@ -35,12 +35,15 @@ import ( | |||
|
|||
var detectionPeriodOfDependsOntask time.Duration | |||
|
|||
// TaskMinAvailable todo(renwenlong) move to volcano.sh api | |||
const TaskMinAvailable = "volcano.sh/task-min-available" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You can do this now.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,I will move it
@@ -235,7 +235,10 @@ func (alloc *Action) Execute(ssn *framework.Session) { | |||
} | |||
|
|||
if ssn.JobReady(job) && !tasks.Empty() { | |||
jobs.Push(job) | |||
// skip dependent job push, because dependent job has other pods will be creat |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
// skip dependent job push, because dependent job has other pods will be creat | |
// skip dependent job push, because dependent job has other pods will be create |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
get
TaskPriorityAnnotation = "volcano.sh/task-priority" | ||
TaskMinAvailable = "volcano.sh/task-min-available" | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think these need to be normalized, such as put them in the api
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok,I will move it
if len(job.Spec.Tasks) > 1 && job.Spec.MinAvailable != totalReplicas { | ||
msg += " Multi-tasks job 'minAvailable' needs to set task 'minAvailable', " + | ||
"otherwise job 'minAvailable' must be equal to the sum of task 'replicas';" | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
job.Spec.MinAvailable == 5 , totalReplicas =6 ,I think this is OK
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did not explain my idea. If multi-task does not set task.minAvailable, it cannot explain that those tasks are equal to job.minAvailable.
apiVersion: batch.volcano.sh/v1alpha1
kind: Job
metadata:
name: minavailable-job
spec:
schedulerName: volcano
minAvailable: 2
tasks:
- replicas: 3
name: "master"
template:
metadata:
name: master
spec:
containers:
- image: nginx
name: nginx
resources:
requests:
cpu: "1"
memory: "1Gi"
restartPolicy: OnFailure
- replicas: 3
name: "work"
template:
metadata:
name: web
spec:
containers:
- image: nginx
name: nginx
resources:
requests:
cpu: "1"
memory: "1Gi"
restartPolicy: OnFailure
master Running 2 ? work Running 2 ? also master 1 and work 1 is ok?
if len(new.Spec.Tasks) > 1 && new.Spec.MinAvailable != totalReplicas { | ||
return fmt.Errorf(" Multi-tasks job 'minAvailable' needs to set task 'minAvailable', " + | ||
"otherwise job 'minAvailable' must be equal to total task 'replicas'") | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think this is needed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If
job.Spec.MinAvailable == 5 , totalReplicas =6 ,I think this is OK.
# user-guide | ||
|
||
When the user uses the vcjob minAvailable feature, only should set each `task.minAvailable` value, if not set `task.minAvailable`, | ||
the default `task.minAvailable=task.replaces`. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
task.minavailable is not equal to task.replaces if job.minavailable is set
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There is only one task in job, job.minavailable or task.minavailable set any one is ok, but Multitasking is ambiguous.
|
||
<img src="images/minAvailable-dependsOn-3.png" alt="dependsOn1" width="700"><br> | ||
|
||
### 2、task gang |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Duplicated with line 218?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I will fix it
``` | ||
|
||
# TODO | ||
How to optimize dependsOn job to meet gang scheduling? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it is most important that we deal with resource reservation, including resource reservation in the case of multiple schedulers, please add this information
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's a complicated issue, I can't fix it in this pr, which means that dependency tasks don't support gang like before, but this pr solves the problem of scheduling deadlock
@lowang-bh |
I just find the others can not see my comments in code review... >_< |
|
break | ||
} | ||
if task.MinAvailable == nil { | ||
task.MinAvailable = &task.Replicas |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is it reasonable to modify task's attribute here?
And, what's more, it dosn't cover all the cases.
if task.DependsOn == nil { | ||
tmpMinReq := v1.ResourceList{} | ||
// only calc task minAvailable | ||
for i := int32(0); i < *task.MinAvailable; i++ { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we refact those duplicate codes? eg, define in a function.
Pods: work-0、work-1、work-2 | ||
|
||
the right pods order should be: | ||
master-0、master-1、master-2、work-0、work-1、master-3、master-4、work-2、work-3 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think it should put in gang plugin.
@@ -188,6 +213,11 @@ func mutateSpec(tasks []v1alpha1.TaskSpec, basePath string, job *v1alpha1.Job) * | |||
// mpi.AddDependsOn(job) | |||
// } | |||
patched := false | |||
if len(tasks) == 1 && tasks[0].MinAvailable == nil { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is special code, I don't think it is a good change.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I agren with you .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That means i was wrong,I'm going to rethink this question🤔️。
Thanks. |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
/reopen |
@hwdef: Reopened this PR. In response to this:
Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
[APPROVALNOTIFIER] This PR is NOT APPROVED This pull-request has been approved by: The full list of commands accepted by this bot can be found here.
Needs approval from an approver in each of these files:
Approvers can indicate their approval by writing |
Is this still relevant? If so, what is blocking it? Is there anything you can do to help move it forward? This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. |
@renwenlong-github: PR needs rebase. Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes/test-infra repository. |
issues #2895