Clarify and make less verbose event message for infeasible pods.

This commit is contained in:
David Oppenheimer 2015-07-01 13:35:24 -07:00
parent 835eded294
commit 950ab8f219
2 changed files with 7 additions and 4 deletions

View File

@ -41,12 +41,15 @@ var ErrNoNodesAvailable = fmt.Errorf("no nodes available to schedule pods")
// implementation of the error interface
func (f *FitError) Error() string {
predicates := util.NewStringSet()
var reason string
// We iterate over all nodes for logging purposes, even though we only return one reason from one node
for node, predicateList := range f.FailedPredicates {
predicates = predicates.Union(predicateList)
glog.Infof("failed to find fit for pod %v on node %s: %s", f.Pod.Name, node, strings.Join(predicateList.List(), ","))
if len(reason) == 0 {
reason, _ = predicateList.PopAny()
}
}
return fmt.Sprintf("For each of these fitness predicates, pod %v failed on at least one node: %v.", f.Pod.Name, strings.Join(predicates.List(), ","))
return fmt.Sprintf("Failed for reason %s and possibly others", reason)
}
type genericScheduler struct {

View File

@ -125,7 +125,7 @@ func (s *Scheduler) scheduleOne() {
metrics.SchedulingAlgorithmLatency.Observe(metrics.SinceInMicroseconds(start))
if err != nil {
glog.V(1).Infof("Failed to schedule: %v", pod)
s.config.Recorder.Eventf(pod, "failedScheduling", "Error scheduling: %v", err)
s.config.Recorder.Eventf(pod, "failedScheduling", "%v", err)
s.config.Error(pod, err)
return
}