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

overcommit plugin AddForMinReq is no need to add other resources. #3521

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xieyanker
Copy link
Contributor

Fix #3520

@volcano-sh-bot
Copy link
Contributor

Welcome @xieyanker!

It looks like this is your first PR to volcano-sh/volcano.

Thank you, and welcome to Volcano. 😃

@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is NOT APPROVED

This pull-request has been approved by:
To complete the pull request process, please assign lowang-bh
You can assign the PR to them by writing /assign @lowang-bh in a comment when ready.

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 /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@volcano-sh-bot volcano-sh-bot added the size/M Denotes a PR that changes 30-99 lines, ignoring generated files. label Jun 13, 2024
Comment on lines +261 to +271
if rr.MilliCPU == 0 {
r.MilliCPU = 0
} else {
r.MilliCPU += rr.MilliCPU
}

if rr.Memory == 0 {
r.Memory = 0
} else {
r.Memory += rr.Memory
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we just use this

r.MilliCPU += rr.MilliCPU
r.Memory += rr.Memory

Comment on lines +273 to +280
newScalarResources := map[v1.ResourceName]float64{}
for rName, rQuant := range rr.ScalarResources {
if r.ScalarResources == nil {
r.ScalarResources = map[v1.ResourceName]float64{}
}
newScalarResources[rName] = r.ScalarResources[rName] + rQuant
}
r.ScalarResources = newScalarResources
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this code OK? It is relatively more readable

if r.ScalarResources == nil {
    r.ScalarResources = map[v1.ResourceName]float64{}
}

for rName, rQuant := range rr.ScalarResources {
    r.ScalarResources[rName] += rQuant
}

@@ -144,3 +144,4 @@ func (op *overcommitPlugin) OnSessionClose(ssn *framework.Session) {
op.idleResource = nil
op.inqueueResource = nil
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this blank line be deleted?
In addition, can some test cases be added to prove this pr?

@googs1025
Copy link
Member

/ok-to-test

@volcano-sh-bot volcano-sh-bot added the ok-to-test Indicates a non-member PR verified by an org member that is safe to test. label Jun 13, 2024
For example, if the minimum request is only 1 CPU core, then there is no need to add memory, GPU and other resources.

Signed-off-by: xieyanker <[email protected]>
@lowang-bh
Copy link
Member

/hold

change origin value is a bit strange.

@volcano-sh-bot volcano-sh-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. ok-to-test Indicates a non-member PR verified by an org member that is safe to test. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

overcommit plugin is no need to check other resources.
4 participants