Skip to content

Commit

Permalink
Fix go vet errors
Browse files Browse the repository at this point in the history
  • Loading branch information
ronensc committed Nov 15, 2023
1 parent baf2378 commit 7683cd4
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions pkg/apis/quotaplugins/quotasubtree/v1alpha1/types.go
Original file line number Diff line number Diff line change
Expand Up @@ -70,8 +70,8 @@ type Quota struct {

// QuotaSubtreeStatus is the status for a QuotaSubtree resource
type QuotaSubtreeStatus struct {
TotalAllocation ResourceAllocation `json:"totalAllocation,omitempty protobuf:"bytes,1,opt,name=totalAllocation"`
Children []ResourceAllocation `json:"children,omitempty protobuf:"bytes,2,opt,name=children"`
TotalAllocation ResourceAllocation `json:"totalAllocation,omitempty" protobuf:"bytes,1,opt,name=totalAllocation"`
Children []ResourceAllocation `json:"children,omitempty" protobuf:"bytes,2,opt,name=children"`
}

// ResourceAllocation is the spec for the child status
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/metrics/adapter/provider/provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ type clusterMetricsProvider struct {
var _ provider.ExternalMetricsProvider = (*clusterMetricsProvider)(nil)

// NewFakeProvider returns an instance of clusterMetricsProvider
func NewFakeProvider(client dynamic.Interface, mapper apimeta.RESTMapper, clusterStateCache clusterstatecache.Cache) (provider.ExternalMetricsProvider) {
func NewFakeProvider(client dynamic.Interface, mapper apimeta.RESTMapper, clusterStateCache clusterstatecache.Cache) provider.ExternalMetricsProvider {
klog.V(10).Infof("[NewFakeProvider] Entered NewFakeProvider()")
provider := &clusterMetricsProvider{
client: client,
Expand Down Expand Up @@ -162,14 +162,14 @@ func (p *clusterMetricsProvider) GetExternalMetric(_ context.Context, namespace
} else if strings.Compare(labelVal, "cpu") == 0 {
// Set cpu Value
resources := p.cache2.GetUnallocatedResources()
klog.V(9).Infof("[GetExternalMetric] Cache resources: %f", resources)
klog.V(9).Infof("[GetExternalMetric] Cache resources: %v", resources)

klog.V(10).Infof("[GetExternalMetric] Setting cpu metric Value: %v.", resources.MilliCPU)
metricValue.Value = *resource.NewQuantity(int64(resources.MilliCPU), resource.DecimalSI)
} else if strings.Compare(labelVal, "gpu") == 0 {
// Set gpu Value
resources := p.cache2.GetUnallocatedResources()
klog.V(9).Infof("[GetExternalMetric] Cache resources: %f", resources)
klog.V(9).Infof("[GetExternalMetric] Cache resources: %v", resources)

klog.V(10).Infof("[GetExternalMetric] Setting gpu metric Value: %v.", resources.GPU)
metricValue.Value = *resource.NewQuantity(resources.GPU, resource.DecimalSI)
Expand Down
6 changes: 3 additions & 3 deletions pkg/controller/queuejob/queuejob_controller_ex.go
Original file line number Diff line number Diff line change
Expand Up @@ -1167,14 +1167,14 @@ func (qjm *XController) ScheduleNext(qj *arbv1.AppWrapper) {
klog.Info("%s %s %s", quotaFits, preemptAWs, msg)

if quotaFits {
klog.Infof("[ScheduleNext] [Agent mode] quota evaluation successful for app wrapper '%s/%s' activeQ=%t Unsched=%t &qj=%p Version=%s Status=%+v",
klog.Infof("[ScheduleNext] [Agent mode] quota evaluation successful for app wrapper '%s/%s' duration=%v activeQ=%t Unsched=%t &qj=%p Version=%s Status=%+v",
qj.Namespace, qj.Name, time.Now().Sub(HOLStartTime), qjm.qjqueue.IfExistActiveQ(qj), qjm.qjqueue.IfExistUnschedulableQ(qj), qj, qj.ResourceVersion, qj.Status)
// Set any jobs that are marked for preemption
qjm.preemptAWJobs(ctx, preemptAWs)
} else { // Not enough free quota to dispatch appwrapper
dispatchFailedMessage = "Insufficient quota and/or resources to dispatch AppWrapper."
dispatchFailedReason = "quota limit exceeded"
klog.Infof("[ScheduleNext] [Agent Mode] Blocking dispatch for app wrapper '%s/%s' due to quota limits, activeQ=%t Unsched=%t &qj=%p Version=%s Status=%+v msg=%s",
klog.Infof("[ScheduleNext] [Agent Mode] Blocking dispatch for app wrapper '%s/%s' duration=%v due to quota limits, activeQ=%t Unsched=%t &qj=%p Version=%s Status=%+v msg=%s",
qj.Namespace, qj.Name, time.Now().Sub(HOLStartTime), qjm.qjqueue.IfExistActiveQ(qj), qjm.qjqueue.IfExistUnschedulableQ(qj), qj, qj.ResourceVersion, qj.Status, msg)
// Call update etcd here to retrigger AW execution for failed quota
// TODO: quota management tests fail if this is converted into go-routine, need to inspect why?
Expand Down Expand Up @@ -2032,7 +2032,7 @@ func (cc *XController) manageQueueJob(ctx context.Context, qj *arbv1.AppWrapper,
if apierrors.IsInvalid(err00) {
klog.Warningf("[manageQueueJob] Invalid generic item sent for dispatching by app wrapper='%s/%s' err=%v", qj.Namespace, qj.Name, err00)
} else {
klog.Errorf("[manageQueueJob] Error dispatching generic item for app wrapper='%s/%s' type=%v err=%v", qj.Namespace, qj.Name, err00)
klog.Errorf("[manageQueueJob] Error dispatching generic item for app wrapper='%s/%s' err=%v", qj.Namespace, qj.Name, err00)
}
dispatchFailureMessage = fmt.Sprintf("%s/%s creation failure: %+v", qj.Namespace, qj.Name, err00)
dispatched = false
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ func (qm *QuotaManager) loadDispatchedAWs(dispatchedAWDemands map[string]*cluste
}

if len(preemptionIds) > 0 {
klog.Errorf("[loadDispatchedAWs] Loading of AppWrapper %s/%s caused invalid preemptions: %v. Quota Manager is in inconsistent state, reason:",
klog.Errorf("[loadDispatchedAWs] Loading of AppWrapper %s/%s caused invalid preemptions: %v. Quota Manager is in inconsistent state, reason: %v",
aw.Namespace, aw.Name, preemptionIds, errorMessage)
result = multierror.Append(result, fmt.Errorf("loading of AppWrapper %s/%s caused invalid preemptions: %v. Quota Manager is in inconsistent state",
aw.Namespace, aw.Name, preemptionIds))
Expand Down

0 comments on commit 7683cd4

Please sign in to comment.