Skip to content

Commit

Permalink
fix: log info or error print
Browse files Browse the repository at this point in the history
Signed-off-by: googs1025 <googs1025@gmail.com>

fix: log level

Signed-off-by: googs1025 <googs1025@gmail.com>
  • Loading branch information
googs1025 committed May 6, 2024
1 parent b53d6d8 commit 6b1522f
Show file tree
Hide file tree
Showing 8 changed files with 19 additions and 22 deletions.
2 changes: 1 addition & 1 deletion cmd/webhook-manager/app/util.go
Expand Up @@ -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 {
Expand Down
5 changes: 2 additions & 3 deletions pkg/scheduler/actions/allocate/allocate.go
Expand Up @@ -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)
Expand Down Expand Up @@ -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)
Expand Down
6 changes: 3 additions & 3 deletions pkg/scheduler/actions/backfill/backfill.go
Expand Up @@ -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 {
Expand All @@ -68,15 +68,15 @@ 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)
}
job.NodesFitErrors[task.UID] = fe
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
Expand Down
14 changes: 6 additions & 8 deletions pkg/scheduler/actions/reclaim/reclaim.go
Expand Up @@ -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)
Expand Down Expand Up @@ -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
}

Expand All @@ -126,7 +125,7 @@ func (ra *Action) Execute(ssn *framework.Session) {
var statusSets util.StatusSets
statusSets, err := ssn.PredicateFn(task, n)
if err != nil {
klog.V(5).Infof("reclaim predicates failed for task <%s/%s> on node <%s>: %v",
klog.V(4).Infof("reclaim predicates failed for task <%s/%s> on node <%s>: %v",
task.Namespace, task.Name, n.Name, err)
continue
}
Expand All @@ -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 {
Expand Down Expand Up @@ -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
}

Expand All @@ -179,7 +177,7 @@ func (ra *Action) Execute(ssn *framework.Session) {

// Reclaim victims for tasks.
for _, reclaimee := range victims {
klog.Errorf("Try to reclaim Task <%s/%s> for Tasks <%s/%s>",
klog.V(4).Infof("Try to reclaim Task <%s/%s> for Tasks <%s/%s>",
reclaimee.Namespace, reclaimee.Name, task.Namespace, task.Name)
if err := ssn.Evict(reclaimee, "reclaim"); err != nil {
klog.Errorf("Failed to reclaim Task <%s/%s> for Tasks <%s/%s>: %v",
Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/plugins/nodegroup/nodegroup.go
Expand Up @@ -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
}

Expand Down
2 changes: 1 addition & 1 deletion pkg/scheduler/plugins/sla/sla.go
Expand Up @@ -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"
)
Expand Down
6 changes: 3 additions & 3 deletions pkg/scheduler/plugins/usage/usage.go
Expand Up @@ -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)
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions pkg/scheduler/plugins/usage/usage_test.go
Expand Up @@ -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),
},
},
{
Expand Down Expand Up @@ -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),
},
},
{
Expand Down

0 comments on commit 6b1522f

Please sign in to comment.