mirror of
https://github.com/kemko/nomad.git
synced 2026-01-05 09:55:44 +03:00
use structured logging everywhere consistently
This commit is contained in:
@@ -454,7 +454,7 @@ func newAllocDeviceGroup() *deviceGroupAllocs {
|
||||
}
|
||||
|
||||
// PreemptForDevice tries to find allocations to preempt to meet devices needed
|
||||
// This is called once per task when assigning devices to the task
|
||||
// This is called once per device request when assigning devices to the task
|
||||
func (p *Preemptor) PreemptForDevice(ask *structs.RequestedDevice, devAlloc *deviceAllocator) []*structs.Allocation {
|
||||
|
||||
// Group allocations by device, tracking the number of
|
||||
@@ -473,6 +473,7 @@ func (p *Preemptor) PreemptForDevice(ask *structs.RequestedDevice, devAlloc *dev
|
||||
deviceIdTuple := *device.ID()
|
||||
devInst := devAlloc.Devices[deviceIdTuple]
|
||||
|
||||
// devInst can be nil if the device is no longer healthy
|
||||
if devInst == nil {
|
||||
continue
|
||||
}
|
||||
@@ -490,8 +491,6 @@ func (p *Preemptor) PreemptForDevice(ask *structs.RequestedDevice, devAlloc *dev
|
||||
deviceToAllocs[deviceIdTuple] = allocDeviceGrp
|
||||
}
|
||||
allocDeviceGrp.allocs = append(allocDeviceGrp.allocs, alloc)
|
||||
devCount := allocDeviceGrp.deviceInstances[alloc.ID]
|
||||
devCount += len(device.DeviceIDs)
|
||||
allocDeviceGrp.deviceInstances[alloc.ID] += len(device.DeviceIDs)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -251,7 +251,7 @@ OUTER:
|
||||
|
||||
netPreemptions := preemptor.PreemptForNetwork(ask, netIdx)
|
||||
if netPreemptions == nil {
|
||||
iter.ctx.Logger().Named("binpack").Error(fmt.Sprintf("unable to meet network resource %v after preemption", ask))
|
||||
iter.ctx.Logger().Named("binpack").Error("preemption not possible ", "network_resource", ask)
|
||||
netIdx.Release()
|
||||
continue OUTER
|
||||
}
|
||||
@@ -268,7 +268,7 @@ OUTER:
|
||||
|
||||
offer, err = netIdx.AssignNetwork(ask)
|
||||
if offer == nil {
|
||||
iter.ctx.Logger().Named("binpack").Error(fmt.Sprintf("unexpected error, unable to create offer after preempting:%v", err))
|
||||
iter.ctx.Logger().Named("binpack").Error("unexpected error, unable to create network offer after considering preemption", "error", err)
|
||||
netIdx.Release()
|
||||
continue OUTER
|
||||
}
|
||||
@@ -296,7 +296,7 @@ OUTER:
|
||||
devicePreemptions := preemptor.PreemptForDevice(req, devAllocator)
|
||||
|
||||
if devicePreemptions == nil {
|
||||
iter.ctx.Logger().Named("binpack").Error(fmt.Sprintf("unable to meet device resource need after attempting preemption:%v", req))
|
||||
iter.ctx.Logger().Named("binpack").Error("preemption not possible", "requested_device", req)
|
||||
netIdx.Release()
|
||||
continue OUTER
|
||||
}
|
||||
@@ -312,7 +312,7 @@ OUTER:
|
||||
// Try offer again
|
||||
offer, sumAffinities, err = devAllocator.AssignDevice(req)
|
||||
if offer == nil {
|
||||
iter.ctx.Logger().Named("binpack").Error(fmt.Sprintf("unexpected error, unable to create device offer after preempting:%v", err))
|
||||
iter.ctx.Logger().Named("binpack").Error("unexpected error, unable to create device offer after considering preemption", "error", err)
|
||||
continue OUTER
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user