Skip to content

Commit e030204

Browse files
committed
[core] Improve logging in scheduler
1 parent 0b049b1 commit e030204

1 file changed

Lines changed: 22 additions & 6 deletions

File tree

core/scheduler.go

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -369,7 +369,8 @@ func resourceOffers(state *internalState, fidStore store.Singleton) events.Handl
369369
targetExecutorId.Value = offer.ExecutorIDs[0].Value
370370
}
371371

372-
log.WithPrefix("scheduler").WithFields(logrus.Fields{
372+
log.WithPrefix("scheduler").
373+
WithFields(logrus.Fields{
373374
"offerId": offer.ID.Value,
374375
"resources": remainingResources.String(),
375376
}).Debug("processing offer")
@@ -386,21 +387,34 @@ func resourceOffers(state *internalState, fidStore store.Singleton) events.Handl
386387
}
387388
}
388389

389-
log.Debug("state lock")
390+
log.WithPrefix("scheduler").Debug("state lock")
390391
state.Lock()
391392

392393
// We iterate down over the descriptors, and we remove them as we match
393394
FOR_DESCRIPTORS:
394395
for i := len(descriptorsToDeploy)-1; i >= 0; i-- {
395396
descriptor := descriptorsToDeploy[i]
397+
log.WithPrefix("scheduler").
398+
WithField("taskClass", descriptor.TaskClassName).
399+
Debug("processing descriptor")
396400
offerAttributes := constraint.Attributes(offer.Attributes)
397401
if !offerAttributes.Satisfy(descriptorConstraints[descriptor]) {
402+
if state.config.veryVerbose {
403+
log.WithPrefix("scheduler").
404+
WithFields(logrus.Fields{
405+
"taskClass": descriptor.TaskClassName,
406+
"constraints": descriptorConstraints[descriptor],
407+
"offerId": offer.ID.Value,
408+
"resources": remainingResources.String(),
409+
}).
410+
Warn("descriptor constraints not satisfied by offer")
411+
}
398412
continue
399413
}
400414

401415
wants := state.taskman.GetWantsForDescriptor(descriptor)
402416
if wants == nil {
403-
log.WithField("class", descriptor.TaskClassName).
417+
log.WithPrefix("scheduler").WithField("class", descriptor.TaskClassName).
404418
Warning("no resource demands for descriptor, invalid class perhaps?")
405419
continue
406420
}
@@ -485,7 +499,7 @@ func resourceOffers(state *internalState, fidStore store.Singleton) events.Handl
485499
}).
486500
Error("cannot serialize mesos.CommandInfo for executor")
487501
state.Unlock()
488-
log.Debug("state unlock")
502+
log.WithPrefix("scheduler").Debug("state unlock")
489503
continue
490504
}
491505

@@ -528,7 +542,8 @@ func resourceOffers(state *internalState, fidStore store.Singleton) events.Handl
528542
Data: jsonCommand, // this ends up in LAUNCH for the executor
529543
}
530544

531-
log.WithFields(logrus.Fields{
545+
log.WithPrefix("scheduler").
546+
WithFields(logrus.Fields{
532547
"taskId": newTaskId,
533548
"offerId": offer.ID.Value,
534549
"executorId": state.executor.ExecutorID.Value,
@@ -540,7 +555,7 @@ func resourceOffers(state *internalState, fidStore store.Singleton) events.Handl
540555
tasksDeployedForCurrentOffer[taskPtr] = descriptor
541556
}
542557
state.Unlock()
543-
log.Debug("state unlock")
558+
log.WithPrefix("scheduler").Debug("state unlock")
544559

545560
// build ACCEPT call to launch all of the tasks we've assembled
546561
accept := calls.Accept(
@@ -606,6 +621,7 @@ func resourceOffers(state *internalState, fidStore store.Singleton) events.Handl
606621
select {
607622
case state.resourceOffersDone <- tasksDeployed:
608623
log.WithPrefix("scheduler").
624+
WithField("tasksDeployed", len(tasksDeployed)).
609625
Debug("notified listeners on resourceOffers done")
610626
default:
611627
if state.config.veryVerbose {

0 commit comments

Comments
 (0)