Merge pull request #7714 from filecoin-project/feat/sched-review

Address Scheduler enhancements (#7703) review
This commit is contained in:
Łukasz Magiera 2021-11-30 23:03:03 +01:00 committed by GitHub
commit 26c9120d22
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 10 additions and 7 deletions

View File

@ -322,7 +322,7 @@ func TestRestartWorker(t *testing.T) {
defer cleanup() defer cleanup()
localTasks := []sealtasks.TaskType{ localTasks := []sealtasks.TaskType{
sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTAddPiece, sealtasks.TTFetch,
} }
wds := datastore.NewMapDatastore() wds := datastore.NewMapDatastore()
@ -466,7 +466,7 @@ func TestResUse(t *testing.T) {
defer cleanup() defer cleanup()
localTasks := []sealtasks.TaskType{ localTasks := []sealtasks.TaskType{
sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTAddPiece, sealtasks.TTFetch,
} }
wds := datastore.NewMapDatastore() wds := datastore.NewMapDatastore()
@ -524,7 +524,7 @@ func TestResOverride(t *testing.T) {
defer cleanup() defer cleanup()
localTasks := []sealtasks.TaskType{ localTasks := []sealtasks.TaskType{
sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTAddPiece, sealtasks.TTFetch,
} }
wds := datastore.NewMapDatastore() wds := datastore.NewMapDatastore()

View File

@ -74,10 +74,12 @@ func (a *activeResources) canHandleRequest(needRes storiface.Resources, wid stor
vmemNeeded := needRes.MaxMemory + needRes.BaseMinMemory vmemNeeded := needRes.MaxMemory + needRes.BaseMinMemory
vmemUsed := a.memUsedMax vmemUsed := a.memUsedMax
if vmemUsed < res.MemUsed+res.MemSwapUsed { workerMemoryReserved := res.MemUsed + res.MemSwapUsed // memory used outside lotus-worker (used by the OS, etc.)
vmemUsed = res.MemUsed + res.MemSwapUsed
if vmemUsed < workerMemoryReserved {
vmemUsed = workerMemoryReserved
} }
vmemAvail := res.MemPhysical + res.MemSwap - vmemUsed vmemAvail := (res.MemPhysical + res.MemSwap) - vmemUsed
if vmemNeeded > vmemAvail { if vmemNeeded > vmemAvail {
log.Debugf("sched: not scheduling on worker %s for %s; not enough virtual memory - need: %dM, have %dM available", wid, caller, vmemNeeded/mib, vmemAvail/mib) log.Debugf("sched: not scheduling on worker %s for %s; not enough virtual memory - need: %dM, have %dM available", wid, caller, vmemNeeded/mib, vmemAvail/mib)

View File

@ -14,7 +14,7 @@ import (
type Resources struct { type Resources struct {
MinMemory uint64 `envname:"MIN_MEMORY"` // What Must be in RAM for decent perf MinMemory uint64 `envname:"MIN_MEMORY"` // What Must be in RAM for decent perf
MaxMemory uint64 `envname:"MAX_MEMORY"` // Memory required (swap + ram) MaxMemory uint64 `envname:"MAX_MEMORY"` // Memory required (swap + ram; peak memory usage during task execution)
// GPUUtilization specifes the number of GPUs a task can use // GPUUtilization specifes the number of GPUs a task can use
GPUUtilization float64 `envname:"GPU_UTILIZATION"` GPUUtilization float64 `envname:"GPU_UTILIZATION"`

View File

@ -109,6 +109,7 @@ func (t *testWorker) Info(ctx context.Context) (storiface.WorkerInfo, error) {
Resources: storiface.WorkerResources{ Resources: storiface.WorkerResources{
MemPhysical: res.MinMemory * 3, MemPhysical: res.MinMemory * 3,
MemUsed: res.MinMemory, MemUsed: res.MinMemory,
MemSwapUsed: 0,
MemSwap: 0, MemSwap: 0,
CPUs: 32, CPUs: 32,
GPUs: nil, GPUs: nil,