Skip to content

Commit ebe6e9c

Browse files
committed
[core] Improved output for "no resource demands for descriptor" issue
1 parent 886c99a commit ebe6e9c

2 files changed

Lines changed: 25 additions & 9 deletions

File tree

core/task/match.go

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,9 @@
2525
package task
2626

2727
import (
28+
"fmt"
29+
30+
"github.com/AliceO2Group/Control/common/utils/uid"
2831
"github.com/AliceO2Group/Control/core/task/channel"
2932
"github.com/AliceO2Group/Control/core/task/constraint"
3033
"github.com/AliceO2Group/Control/core/task/taskclass/port"
@@ -40,26 +43,36 @@ type Wants struct {
4043
}
4144

4245
// GetWantsForDescriptor matches between taskclass and taskmanager's classes
43-
func (m *Manager) GetWantsForDescriptor(descriptor *Descriptor) (r *Wants) {
46+
func (m *Manager) GetWantsForDescriptor(descriptor *Descriptor, envId uid.ID) (r *Wants, err error) {
4447
taskClass, ok := m.classes.GetClass(descriptor.TaskClassName)
4548
if ok && taskClass != nil {
4649
r = &Wants{}
4750
wants := taskClass.Wants
4851
if wants.Cpu != nil {
4952
r.Cpu = *wants.Cpu
53+
} else {
54+
log.WithPrefix("scheduler").
55+
WithField("partition", envId.String()).
56+
Warnf("missing CPU resource requirement for requested task class %s", descriptor.TaskClassName)
5057
}
5158
if wants.Memory != nil {
5259
r.Memory = *wants.Memory
60+
} else {
61+
log.WithPrefix("scheduler").
62+
WithField("partition", envId.String()).
63+
Warnf("missing memory resource requirement for requested task class %s", descriptor.TaskClassName)
5364
}
5465
if wants.Ports != nil {
5566
r.StaticPorts = make(port.Ranges, len(wants.Ports))
5667
copy(r.StaticPorts, wants.Ports)
68+
} else {
69+
log.WithPrefix("scheduler").
70+
WithField("partition", envId.String()).
71+
Warnf("missing ports resource requirement for requested task class %s", descriptor.TaskClassName)
5772
}
5873
r.InboundChannels = channel.MergeInbound(descriptor.RoleBind, taskClass.Bind)
5974
} else {
60-
log.WithField("taskClass", descriptor.TaskClassName).
61-
WithField("constraints", descriptor.RoleConstraints.String()).
62-
Warnf("task class not found for descriptor")
75+
err = fmt.Errorf("attempted to get wants for descriptor but task class %s not found in manager", descriptor.TaskClassName)
6376
}
6477
return
6578
}

core/task/scheduler.go

Lines changed: 8 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -575,14 +575,17 @@ func (state *schedulerState) resourceOffers(fidStore store.Singleton) events.Han
575575
WithField("partition", envId.String()).
576576
Debug("offer attributes satisfy constraints")
577577

578-
wants := state.taskman.GetWantsForDescriptor(descriptor)
579-
if wants == nil {
578+
var wants *Wants
579+
wants, err = state.taskman.GetWantsForDescriptor(descriptor, envId)
580+
if err != nil {
580581
log.WithPrefix("scheduler").
582+
WithError(err).
581583
WithField("partition", envId.String()).
582584
WithFields(logrus.Fields{
583-
"class": descriptor.TaskClassName,
584-
"level": infologger.IL_Devel,
585-
"offerHost": offer.Hostname,
585+
"class": descriptor.TaskClassName,
586+
"constraints": descriptor.RoleConstraints.String(),
587+
"level": infologger.IL_Devel,
588+
"offerHost": offer.Hostname,
586589
}).
587590
Error("invalid task class: no task class or no resource demands for descriptor, WILL NOT BE DEPLOYED")
588591
continue

0 commit comments

Comments
 (0)