Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Address Scheduler enhancements (#7703) review #7714

Merged
merged 1 commit into from
Nov 30, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions extern/sector-storage/manager_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -322,7 +322,7 @@ func TestRestartWorker(t *testing.T) {
defer cleanup()

localTasks := []sealtasks.TaskType{
sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch,
sealtasks.TTAddPiece, sealtasks.TTFetch,
}

wds := datastore.NewMapDatastore()
Expand Down Expand Up @@ -466,7 +466,7 @@ func TestResUse(t *testing.T) {
defer cleanup()

localTasks := []sealtasks.TaskType{
sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch,
sealtasks.TTAddPiece, sealtasks.TTFetch,
}

wds := datastore.NewMapDatastore()
Expand Down Expand Up @@ -524,7 +524,7 @@ func TestResOverride(t *testing.T) {
defer cleanup()

localTasks := []sealtasks.TaskType{
sealtasks.TTAddPiece, sealtasks.TTPreCommit1, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch,
sealtasks.TTAddPiece, sealtasks.TTFetch,
}

wds := datastore.NewMapDatastore()
Expand Down
8 changes: 5 additions & 3 deletions extern/sector-storage/sched_resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,10 +74,12 @@ func (a *activeResources) canHandleRequest(needRes storiface.Resources, wid stor

vmemNeeded := needRes.MaxMemory + needRes.BaseMinMemory
vmemUsed := a.memUsedMax
if vmemUsed < res.MemUsed+res.MemSwapUsed {
vmemUsed = res.MemUsed + res.MemSwapUsed
workerMemoryReserved := res.MemUsed + res.MemSwapUsed // memory used outside lotus-worker (used by the OS, etc.)

if vmemUsed < workerMemoryReserved {
vmemUsed = workerMemoryReserved
}
vmemAvail := res.MemPhysical + res.MemSwap - vmemUsed
vmemAvail := (res.MemPhysical + res.MemSwap) - vmemUsed

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)
Expand Down
2 changes: 1 addition & 1 deletion extern/sector-storage/storiface/resources.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import (

type Resources struct {
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 float64 `envname:"GPU_UTILIZATION"`
Expand Down
1 change: 1 addition & 0 deletions extern/sector-storage/testworker_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,7 @@ func (t *testWorker) Info(ctx context.Context) (storiface.WorkerInfo, error) {
Resources: storiface.WorkerResources{
MemPhysical: res.MinMemory * 3,
MemUsed: res.MinMemory,
MemSwapUsed: 0,
MemSwap: 0,
CPUs: 32,
GPUs: nil,
Expand Down