diff --git a/cmd/webhook-manager/app/util.go b/cmd/webhook-manager/app/util.go index da023b629bf..6305744d8cf 100644 --- a/cmd/webhook-manager/app/util.go +++ b/cmd/webhook-manager/app/util.go @@ -119,7 +119,7 @@ func getKubeClient(restConfig *rest.Config) *kubernetes.Clientset { return clientset } -// GetVolcanoClient get a clientset for volcano. +// getVolcanoClient get a clientset for volcano. func getVolcanoClient(restConfig *rest.Config) *versioned.Clientset { clientset, err := versioned.NewForConfig(restConfig) if err != nil { diff --git a/pkg/scheduler/actions/allocate/allocate.go b/pkg/scheduler/actions/allocate/allocate.go index 888c10dc9a9..334f8b2d747 100644 --- a/pkg/scheduler/actions/allocate/allocate.go +++ b/pkg/scheduler/actions/allocate/allocate.go @@ -181,7 +181,7 @@ func (alloc *Action) allocateResourcesForTasks(tasks *util.PriorityQueue, job *a klog.V(3).Infof("There are <%d> nodes for Job <%v/%v>", len(ssn.Nodes), job.Namespace, job.Name) if err := ssn.PrePredicateFn(task); err != nil { - klog.V(3).Infof("PrePredicate for task %s/%s failed for: %v", task.Namespace, task.Name, err) + klog.V(4).Infof("PrePredicate for task %s/%s failed for: %v", task.Namespace, task.Name, err) fitErrors := api.NewFitErrors() for _, ni := range allNodes { fitErrors.SetNodeError(ni.Name, err) @@ -246,8 +246,7 @@ func (alloc *Action) allocateResourcesForTasks(tasks *util.PriorityQueue, job *a // Allocate idle resource to the task. if task.InitResreq.LessEqual(bestNode.Idle, api.Zero) { - klog.V(3).Infof("Binding Task <%v/%v> to node <%v>", - task.Namespace, task.Name, bestNode.Name) + klog.V(3).Infof("Binding Task <%v/%v> to node <%v>", task.Namespace, task.Name, bestNode.Name) if err := stmt.Allocate(task, bestNode); err != nil { klog.Errorf("Failed to bind Task %v on %v in Session %v, err: %v", task.UID, bestNode.Name, ssn.UID, err) diff --git a/pkg/scheduler/actions/backfill/backfill.go b/pkg/scheduler/actions/backfill/backfill.go index 561ed4a52f2..15c3a10ed91 100644 --- a/pkg/scheduler/actions/backfill/backfill.go +++ b/pkg/scheduler/actions/backfill/backfill.go @@ -44,7 +44,7 @@ func (backfill *Action) Execute(ssn *framework.Session) { klog.V(5).Infof("Enter Backfill ...") defer klog.V(5).Infof("Leaving Backfill ...") - predicatFunc := func(task *api.TaskInfo, node *api.NodeInfo) ([]*api.Status, error) { + predicateFunc := func(task *api.TaskInfo, node *api.NodeInfo) ([]*api.Status, error) { var statusSets util.StatusSets statusSets, err := ssn.PredicateFn(task, node) if err != nil { @@ -68,7 +68,7 @@ func (backfill *Action) Execute(ssn *framework.Session) { fe := api.NewFitErrors() if err := ssn.PrePredicateFn(task); err != nil { - klog.V(3).Infof("PrePredicate for task %s/%s failed in backfill for: %v", task.Namespace, task.Name, err) + klog.V(4).Infof("PrePredicate for task %s/%s failed in backfill for: %v", task.Namespace, task.Name, err) for _, ni := range ssn.Nodes { fe.SetNodeError(ni.Name, err) } @@ -76,7 +76,7 @@ func (backfill *Action) Execute(ssn *framework.Session) { break } - predicateNodes, fitErrors := ph.PredicateNodes(task, ssn.NodeList, predicatFunc, true) + predicateNodes, fitErrors := ph.PredicateNodes(task, ssn.NodeList, predicateFunc, true) if len(predicateNodes) == 0 { job.NodesFitErrors[task.UID] = fitErrors break diff --git a/pkg/scheduler/actions/reclaim/reclaim.go b/pkg/scheduler/actions/reclaim/reclaim.go index 0b95d876db2..b6f4697c819 100644 --- a/pkg/scheduler/actions/reclaim/reclaim.go +++ b/pkg/scheduler/actions/reclaim/reclaim.go @@ -60,8 +60,7 @@ func (ra *Action) Execute(ssn *framework.Session) { } if queue, found := ssn.Queues[job.Queue]; !found { - klog.Errorf("Failed to find Queue <%s> for Job <%s/%s>", - job.Queue, job.Namespace, job.Name) + klog.Errorf("Failed to find Queue <%s> for Job <%s/%s>", job.Queue, job.Namespace, job.Name) continue } else if _, existed := queueMap[queue.UID]; !existed { klog.V(4).Infof("Added Queue <%s> for Job <%s/%s>", queue.Name, job.Namespace, job.Name) @@ -117,7 +116,7 @@ func (ra *Action) Execute(ssn *framework.Session) { } if err := ssn.PrePredicateFn(task); err != nil { - klog.V(3).Infof("PrePredicate for task %s/%s failed for: %v", task.Namespace, task.Name, err) + klog.V(4).Infof("PrePredicate for task %s/%s failed for: %v", task.Namespace, task.Name, err) continue } @@ -137,8 +136,7 @@ func (ra *Action) Execute(ssn *framework.Session) { task.Namespace, task.Name, n.Name, statusSets.Message()) continue } - klog.V(3).Infof("Considering Task <%s/%s> on Node <%s>.", - task.Namespace, task.Name, n.Name) + klog.V(3).Infof("Considering Task <%s/%s> on Node <%s>.", task.Namespace, task.Name, n.Name) var reclaimees []*api.TaskInfo for _, task := range n.Tasks { @@ -170,7 +168,7 @@ func (ra *Action) Execute(ssn *framework.Session) { victims := ssn.Reclaimable(task, reclaimees) if err := util.ValidateVictims(task, n, victims); err != nil { - klog.V(3).Infof("No validated victims on Node <%s>: %v", n.Name, err) + klog.V(4).Infof("No validated victims on Node <%s>: %v", n.Name, err) continue } diff --git a/pkg/scheduler/plugins/nodegroup/nodegroup.go b/pkg/scheduler/plugins/nodegroup/nodegroup.go index 3b63570b7bf..117459c7ba8 100644 --- a/pkg/scheduler/plugins/nodegroup/nodegroup.go +++ b/pkg/scheduler/plugins/nodegroup/nodegroup.go @@ -48,7 +48,7 @@ func New(arguments framework.Arguments) framework.Plugin { return &nodeGroupPlugin{pluginArguments: arguments} } -func (pp *nodeGroupPlugin) Name() string { +func (np *nodeGroupPlugin) Name() string { return PluginName } diff --git a/pkg/scheduler/plugins/sla/sla.go b/pkg/scheduler/plugins/sla/sla.go index 453f38c4c9c..b72d2f1e6b9 100644 --- a/pkg/scheduler/plugins/sla/sla.go +++ b/pkg/scheduler/plugins/sla/sla.go @@ -30,7 +30,7 @@ const ( // PluginName indicates name of volcano scheduler plugin PluginName = "sla" // JobWaitingTime is maximum waiting time that a job could stay Pending in service level agreement - // when job waits longer than waiting time, it should be inqueue at once, and cluster should reserve resources for it + // when job waits longer than waiting time, it should be enqueue at once, and cluster should reserve resources for it // Valid time units are “ns”, “us” (or “µs”), “ms”, “s”, “m”, “h” JobWaitingTime = "sla-waiting-time" ) diff --git a/pkg/scheduler/plugins/usage/usage.go b/pkg/scheduler/plugins/usage/usage.go index 63af39a9f18..3c89ad51a8d 100644 --- a/pkg/scheduler/plugins/usage/usage.go +++ b/pkg/scheduler/plugins/usage/usage.go @@ -144,14 +144,14 @@ func (up *usagePlugin) OnSessionOpen(ssn *framework.Session) { usageStatus.Code = api.UnschedulableAndUnresolvable usageStatus.Reason = NodeUsageCPUExtend predicateStatus = append(predicateStatus, usageStatus) - return predicateStatus, fmt.Errorf("Plugin %s predicates failed, because of %s", up.Name(), NodeUsageCPUExtend) + return predicateStatus, fmt.Errorf("plugin %s predicates failed, because of %s", up.Name(), NodeUsageCPUExtend) } if node.ResourceUsage.MEMUsageAvg[up.period] > up.memThresholds { klog.V(3).Infof("Node %s mem usage %f exceeds the threshold %f", node.Name, node.ResourceUsage.MEMUsageAvg[up.period], up.memThresholds) usageStatus.Code = api.UnschedulableAndUnresolvable usageStatus.Reason = NodeUsageMemoryExtend predicateStatus = append(predicateStatus, usageStatus) - return predicateStatus, fmt.Errorf("Plugin %s predicates failed, because of %s", up.Name(), NodeUsageMemoryExtend) + return predicateStatus, fmt.Errorf("plugin %s predicates failed, because of %s", up.Name(), NodeUsageMemoryExtend) } klog.V(4).Infof("Usage plugin filter for task %s/%s on node %s pass.", task.Namespace, task.Name, node.Name) @@ -180,7 +180,7 @@ func (up *usagePlugin) OnSessionOpen(ssn *framework.Session) { return 0, nil } memoryScore := (100 - memoryUsage) / 100 * float64(up.memoryWeight) - score = (cpuScore + memoryScore) / float64((up.cpuWeight + up.memoryWeight)) + score = (cpuScore + memoryScore) / float64(up.cpuWeight+up.memoryWeight) score *= float64(k8sFramework.MaxNodeScore * int64(up.usageWeight)) klog.V(4).Infof("Node %s score for task %s is %f.", node.Name, task.Name, score) return score, nil diff --git a/pkg/scheduler/plugins/usage/usage_test.go b/pkg/scheduler/plugins/usage/usage_test.go index 075fa30572b..a679d4b22d1 100644 --- a/pkg/scheduler/plugins/usage/usage_test.go +++ b/pkg/scheduler/plugins/usage/usage_test.go @@ -160,7 +160,7 @@ func TestUsage_predicateFn(t *testing.T) { Reason: NodeUsageCPUExtend, }, }, - err: fmt.Errorf("Plugin %s predicates failed, because of %s", PluginName, NodeUsageCPUExtend), + err: fmt.Errorf("plugin %s predicates failed, because of %s", PluginName, NodeUsageCPUExtend), }, }, { @@ -194,7 +194,7 @@ func TestUsage_predicateFn(t *testing.T) { Reason: NodeUsageMemoryExtend, }, }, - err: fmt.Errorf("Plugin %s predicates failed, because of %s", PluginName, NodeUsageMemoryExtend), + err: fmt.Errorf("plugin %s predicates failed, because of %s", PluginName, NodeUsageMemoryExtend), }, }, {