Merge pull request #7714 from filecoin-project/feat/sched-review
Address Scheduler enhancements (#7703) review
This commit is contained in:
commit
26c9120d22
6
extern/sector-storage/manager_test.go
vendored
6
extern/sector-storage/manager_test.go
vendored
@ -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()
|
||||||
|
8
extern/sector-storage/sched_resources.go
vendored
8
extern/sector-storage/sched_resources.go
vendored
@ -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)
|
||||||
|
2
extern/sector-storage/storiface/resources.go
vendored
2
extern/sector-storage/storiface/resources.go
vendored
@ -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"`
|
||||||
|
1
extern/sector-storage/testworker_test.go
vendored
1
extern/sector-storage/testworker_test.go
vendored
@ -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,
|
||||||
|
Loading…
Reference in New Issue
Block a user