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

Update enqueue action, import overcommit plugin to limit pending jobs from inqueue. #1298

Merged
merged 3 commits into from
Feb 9, 2021

Conversation

jiangkaihua
Copy link
Contributor

No description provided.

@volcano-sh-bot volcano-sh-bot added the size/L Denotes a PR that changes 100-499 lines, ignoring generated files. label Feb 7, 2021
@jiangkaihua jiangkaihua force-pushed the overcommit branch 8 times, most recently from d5a0744 to e721964 Compare February 7, 2021 12:43
@@ -655,7 +663,7 @@ func (ssn *Session) NodeOrderMapFn(task *api.TaskInfo, node *api.NodeInfo) (map[
return nodeScoreMap, priorityScore, nil
}

// NodeOrderReduceFn invoke node order function of the plugins
// NodeOrderReduceFn invoke nodeOrder function of the plugins
Copy link
Member

Choose a reason for hiding this comment

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

seperate those typo to different PRs.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

already deleted these.

@jiangkaihua jiangkaihua force-pushed the overcommit branch 3 times, most recently from 8bba1de to 5ff6c97 Compare February 8, 2021 06:55

func (op *overcommitPlugin) OnSessionOpen(ssn *framework.Session) {
overcommitStartTime := time.Now().UnixNano()
op.pluginArguments.GetFloat64(&op.overCommitFactor, overCommitFactor)
Copy link
Contributor

Choose a reason for hiding this comment

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

add overCommitFactor illegal check

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Added overcommit-factor validity check: if input < 1, print warning logs & use default value instead.

Copy link
Member

Choose a reason for hiding this comment

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

what happen if overcommit-factor is an invalid number?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

what happen if overcommit-factor is an invalid number?

GetFloat64() do not return err, only print warning logs, so here initializes overcommit-factor with an illegal value -1. If its value is not updated after GetFloat64(), it will be processed the sam as condition 'input < 1'.

func (a Arguments) GetFloat64(ptr *float64, key string) {

@jiangkaihua jiangkaihua force-pushed the overcommit branch 2 times, most recently from 0c1a593 to b08bcc3 Compare February 8, 2021 09:52
Signed-off-by: jiangkaihua <jiangkaihua1@huawei.com>
…ion.

Signed-off-by: jiangkaihua <jiangkaihua1@huawei.com>
}
klog.V(4).Infof("overcommit plugin starts, overCommitFactor: %f", op.overCommitFactor)
defer klog.V(4).Infof("overcommit plugin finishes, execution time: %dns",
time.Now().UnixNano()-overcommitStartTime)
Copy link
Member

Choose a reason for hiding this comment

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

Please remove time calculation in product, it only used for debug or analysis.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

time calculation is already removed.

op.inqueueResource.Add(jobMinReq)
return true
}
klog.V(4).Infof("idle resource in cluster is overused, ignore job <%s/%s>",
Copy link
Member

Choose a reason for hiding this comment

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

change log from "idle resource in cluster is overused" to "resource in cluster is overused, not allow job <%s/%s> be inqueue"

Copy link
Contributor Author

Choose a reason for hiding this comment

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

modified this log.

Signed-off-by: jiangkaihua <jiangkaihua1@huawei.com>
Copy link
Member

@william-wang william-wang left a comment

Choose a reason for hiding this comment

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

/lgtm
/approve

@volcano-sh-bot volcano-sh-bot added lgtm Indicates that a PR is ready to be merged. approved Indicates a PR has been approved by an approver from all required OWNERS files. labels Feb 8, 2021
@Thor-wl
Copy link
Contributor

Thor-wl commented Feb 9, 2021

/lgtm
/approve

@Thor-wl Thor-wl merged commit 844ccef into volcano-sh:master Feb 9, 2021
@volcano-sh-bot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: jiangkaihua, Thor-wl, william-wang

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:
  • OWNERS [Thor-wl,william-wang]

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

" using default value: %f", op.overCommitFactor, defaultOverCommitFactor)
op.overCommitFactor = defaultOverCommitFactor
}
klog.V(4).Infof("Enter overcommit plugin ...")
Copy link
Member

Choose a reason for hiding this comment

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

move to the first line of this func.

func (op *overcommitPlugin) OnSessionOpen(ssn *framework.Session) {
op.pluginArguments.GetFloat64(&op.overCommitFactor, overCommitFactor)
if op.overCommitFactor < 1.0 {
klog.Warningf("invalid input %f for overcommit-factor, reason: overcommit-factor cannot be less than 1,"+
Copy link
Member

Choose a reason for hiding this comment

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

s/invalid/Invalid

inqueue := api.EmptyResource()
for _, job := range ssn.Jobs {
if job.PodGroup.Status.Phase == scheduling.PodGroupInqueue {
inqueue.Add(api.NewResource(*job.PodGroup.Spec.MinResources))
Copy link
Member

Choose a reason for hiding this comment

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

MinResources maybe nil

inqueue.Add(api.NewResource(*job.PodGroup.Spec.MinResources))
}
}
op.inqueueResource = inqueue.Clone()
Copy link
Member

Choose a reason for hiding this comment

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

why clone it?

inqueue := api.EmptyResource()
inqueue.Add(op.inqueueResource)
if job.PodGroup.Spec.MinResources == nil {
klog.V(4).Infof("job <%s/%s> is bestEffort, allow it be inqueue", job.Namespace, job.Name)
Copy link
Member

Choose a reason for hiding this comment

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

s/job/Job

//TODO: if allow 1 more job to be inqueue beyond overcommit-factor, large job may be inqueue and create pods
jobMinReq := api.NewResource(*job.PodGroup.Spec.MinResources)
if inqueue.Add(jobMinReq).LessEqual(idle) {
klog.V(4).Infof("sufficient resources, allow job <%s/%s> be inqueue", job.Namespace, job.Name)
Copy link
Member

Choose a reason for hiding this comment

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

ditto

op.inqueueResource.Add(jobMinReq)
return true
}
klog.V(4).Infof("resource in cluster is overused, not allow job <%s/%s> be inqueue",
Copy link
Member

Choose a reason for hiding this comment

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

ditto

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. lgtm Indicates that a PR is ready to be merged. size/L Denotes a PR that changes 100-499 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants