Skip to content

Commit

Permalink
fix: fix gang log level
Browse files Browse the repository at this point in the history
Signed-off-by: googs1025 <[email protected]>
  • Loading branch information
googs1025 committed Apr 17, 2024
1 parent c8bfd9e commit 746d6bd
Showing 1 changed file with 12 additions and 11 deletions.
23 changes: 12 additions & 11 deletions pkg/scheduler/plugins/coscheduling/core/gang.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,19 +124,20 @@ func (gang *Gang) tryInitByPodConfig(pod *v1.Pod, args *config.CoschedulingArgs)

totalChildrenNum, err := strconv.ParseInt(pod.Annotations[extension.AnnotationGangTotalNum], 10, 32)
if err != nil {
klog.Errorf("pod's annotation totalNumber illegal, gangName: %v, value: %v",
klog.V(4).ErrorS(err, "pod's annotation totalNumber illegal, gangName: %v, value: %v",
gang.Name, pod.Annotations[extension.AnnotationGangTotalNum])
totalChildrenNum = int64(minRequiredNumber)
} else if totalChildrenNum != 0 && totalChildrenNum < int64(minRequiredNumber) {
klog.Errorf("pod's annotation totalNumber cannot less than minRequiredNumber, gangName: %v, totalNumber: %v,minRequiredNumber: %v",

klog.V(4).Infof("pod's annotation totalNumber cannot less than minRequiredNumber, gangName: %v, totalNumber: %v,minRequiredNumber: %v",
gang.Name, pod.Annotations[extension.AnnotationGangTotalNum], minRequiredNumber)
totalChildrenNum = int64(minRequiredNumber)
}
gang.TotalChildrenNum = int(totalChildrenNum)

mode := pod.Annotations[extension.AnnotationGangMode]
if mode != extension.GangModeStrict && mode != extension.GangModeNonStrict {
klog.Errorf("pod's annotation GangModeAnnotation illegal, gangName: %v, value: %v",
klog.V(4).Infof("pod's annotation GangModeAnnotation illegal, gangName: %v, value: %v",
gang.Name, pod.Annotations[extension.AnnotationGangMode])
mode = extension.GangModeStrict
}
Expand All @@ -145,7 +146,7 @@ func (gang *Gang) tryInitByPodConfig(pod *v1.Pod, args *config.CoschedulingArgs)
matchPolicy := util.GetGangMatchPolicyByPod(pod)
if matchPolicy != extension.GangMatchPolicyOnlyWaiting && matchPolicy != extension.GangMatchPolicyWaitingAndRunning &&
matchPolicy != extension.GangMatchPolicyOnceSatisfied {
klog.Errorf("pod's annotation AnnotationGangMatchPolicy illegal, gangName: %v, value: %v",
klog.V(4).Infof("pod's annotation AnnotationGangMatchPolicy illegal, gangName: %v, value: %v",
gang.Name, matchPolicy)
matchPolicy = extension.GangMatchPolicyOnceSatisfied
}
Expand All @@ -157,15 +158,15 @@ func (gang *Gang) tryInitByPodConfig(pod *v1.Pod, args *config.CoschedulingArgs)

waitTime, err := time.ParseDuration(pod.Annotations[extension.AnnotationGangWaitTime])
if err != nil || waitTime <= 0 {
klog.Errorf("pod's annotation GangWaitTimeAnnotation illegal, gangName: %v, value: %v",
klog.V(4).ErrorS(err, "pod's annotation GangWaitTimeAnnotation illegal, gangName: %v, value: %v",
gang.Name, pod.Annotations[extension.AnnotationGangWaitTime])
waitTime = args.DefaultTimeout.Duration
}
gang.WaitTime = waitTime

groupSlice, err := util.StringToGangGroupSlice(pod.Annotations[extension.AnnotationGangGroups])
if err != nil {
klog.Errorf("pod's annotation GangGroupsAnnotation illegal, gangName: %v, value: %v",
klog.V(4).ErrorS(err, "pod's annotation GangGroupsAnnotation illegal, gangName: %v, value: %v",
gang.Name, pod.Annotations[extension.AnnotationGangGroups])
}
if len(groupSlice) == 0 {
Expand All @@ -191,19 +192,19 @@ func (gang *Gang) tryInitByPodGroup(pg *v1alpha1.PodGroup, args *config.Coschedu

totalChildrenNum, err := strconv.ParseInt(pg.Annotations[extension.AnnotationGangTotalNum], 10, 32)
if err != nil {
klog.Errorf("podGroup's annotation totalNumber illegal, gangName: %v, value: %v",
klog.V(4).ErrorS(err, "podGroup's annotation totalNumber illegal, gangName: %v, value: %v",
gang.Name, pg.Annotations[extension.AnnotationGangTotalNum])
totalChildrenNum = int64(minRequiredNumber)
} else if totalChildrenNum != 0 && totalChildrenNum < int64(minRequiredNumber) {
klog.Errorf("podGroup's annotation totalNumber cannot less than minRequiredNumber, gangName:%v, totalNumber: %v,minRequiredNumber: %v",
klog.V(4).Infof("podGroup's annotation totalNumber cannot less than minRequiredNumber, gangName:%v, totalNumber: %v,minRequiredNumber: %v",
gang.Name, pg.Annotations[extension.AnnotationGangTotalNum], minRequiredNumber)
totalChildrenNum = int64(minRequiredNumber)
}
gang.TotalChildrenNum = int(totalChildrenNum)

mode := pg.Annotations[extension.AnnotationGangMode]
if mode != extension.GangModeStrict && mode != extension.GangModeNonStrict {
klog.Errorf("podGroup's annotation GangModeAnnotation illegal, gangName: %v, value: %v",
klog.V(4).Infof("podGroup's annotation GangModeAnnotation illegal, gangName: %v, value: %v",
gang.Name, pg.Annotations[extension.AnnotationGangMode])
mode = extension.GangModeStrict
}
Expand All @@ -212,7 +213,7 @@ func (gang *Gang) tryInitByPodGroup(pg *v1alpha1.PodGroup, args *config.Coschedu
matchPolicy := pg.Annotations[extension.AnnotationGangMatchPolicy]
if matchPolicy != extension.GangMatchPolicyOnlyWaiting && matchPolicy != extension.GangMatchPolicyWaitingAndRunning &&
matchPolicy != extension.GangMatchPolicyOnceSatisfied {
klog.Errorf("podGroup's annotation AnnotationGangMatchPolicy illegal, gangName: %v, value: %v",
klog.V(4).Infof("podGroup's annotation AnnotationGangMatchPolicy illegal, gangName: %v, value: %v",
gang.Name, matchPolicy)
matchPolicy = extension.GangMatchPolicyOnceSatisfied
}
Expand All @@ -227,7 +228,7 @@ func (gang *Gang) tryInitByPodGroup(pg *v1alpha1.PodGroup, args *config.Coschedu

groupSlice, err := util.StringToGangGroupSlice(pg.Annotations[extension.AnnotationGangGroups])
if err != nil {
klog.Errorf("podGroup's annotation GangGroupsAnnotation illegal, gangName: %v, value: %v",
klog.V(4).ErrorS(err, "podGroup's annotation GangGroupsAnnotation illegal, gangName: %v, value: %v",
gang.Name, pg.Annotations[extension.AnnotationGangGroups])
}
if len(groupSlice) == 0 {
Expand Down

0 comments on commit 746d6bd

Please sign in to comment.