Log a better error with useful info on scheduling failures.

This commit is contained in:
Brendan Burns
2015-02-23 20:36:22 -08:00
parent 74c0dd179e
commit 33f6576f61
4 changed files with 101 additions and 23 deletions

View File

@@ -120,17 +120,17 @@ func GetAlgorithmProvider(name string) (*AlgorithmProviderConfig, error) {
return &provider, nil
}
func getFitPredicateFunctions(names util.StringSet) ([]algorithm.FitPredicate, error) {
func getFitPredicateFunctions(names util.StringSet) (map[string]algorithm.FitPredicate, error) {
schedulerFactoryMutex.Lock()
defer schedulerFactoryMutex.Unlock()
predicates := []algorithm.FitPredicate{}
predicates := map[string]algorithm.FitPredicate{}
for _, name := range names.List() {
function, ok := fitPredicateMap[name]
if !ok {
return nil, fmt.Errorf("Invalid predicate name %q specified - no corresponding function found", name)
}
predicates = append(predicates, function)
predicates[name] = function
}
return predicates, nil
}