sched: Address review
This commit is contained in:
parent
d57877af31
commit
5f1a27d52b
5
sched.go
5
sched.go
@ -293,6 +293,11 @@ func (sh *scheduler) assignWorker(wid WorkerID, w *workerHandle, req *workerRequ
|
|||||||
})
|
})
|
||||||
|
|
||||||
sh.workersLk.Unlock()
|
sh.workersLk.Unlock()
|
||||||
|
|
||||||
|
// This error should always be nil, since nothing is setting it, but just to be safe:
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("error executing worker (withResources): %+v", err)
|
||||||
|
}
|
||||||
}()
|
}()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
|
@ -27,7 +27,7 @@ func (s *taskSelector) Ok(ctx context.Context, task sealtasks.TaskType, whnd *wo
|
|||||||
return supported, nil
|
return supported, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *taskSelector) Cmp(ctx context.Context, task sealtasks.TaskType, a, b *workerHandle) (bool, error) {
|
func (s *taskSelector) Cmp(ctx context.Context, _ sealtasks.TaskType, a, b *workerHandle) (bool, error) {
|
||||||
atasks, err := a.w.TaskTypes(ctx)
|
atasks, err := a.w.TaskTypes(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, xerrors.Errorf("getting supported worker task types: %w", err)
|
return false, xerrors.Errorf("getting supported worker task types: %w", err)
|
||||||
@ -40,7 +40,7 @@ func (s *taskSelector) Cmp(ctx context.Context, task sealtasks.TaskType, a, b *w
|
|||||||
return len(atasks) < len(btasks), nil // prefer workers which can do less
|
return len(atasks) < len(btasks), nil // prefer workers which can do less
|
||||||
}
|
}
|
||||||
|
|
||||||
return a.info.Hostname > a.info.Hostname, nil // TODO: Better fallback strategy
|
return a.info.Hostname > b.info.Hostname, nil // TODO: Better fallback strategy
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ WorkerSelector = &allocSelector{}
|
var _ WorkerSelector = &allocSelector{}
|
||||||
|
Loading…
Reference in New Issue
Block a user