1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-12 23:36:44 +00:00
This commit is contained in:
2020-05-03 15:19:21 +08:00
parent 1adede3751
commit cfc9d9f8b2
3 changed files with 6 additions and 1 deletions

View File

@@ -7,6 +7,7 @@ import (
"io/ioutil"
"strconv"
"encoding/json"
"time"
)
type Optimizer struct {
@@ -124,7 +125,7 @@ func (optimizer *Optimizer) predictTime(job string) (*OptimizerJobExecutionTime,
str := strings.Split(job, "-")
if len(str) == 2 {
jobName := str[0]
if est, ok := optimizer.cache[jobName]; ok {
if est, ok := optimizer.cache[jobName]; ok && est.Version > (int)(time.Now().Unix())-300 {
return est, true
}
if est, ok := optimizer.predicts[jobName]; ok {
@@ -133,6 +134,7 @@ func (optimizer *Optimizer) predictTime(job string) (*OptimizerJobExecutionTime,
est2.Pre = est.Pre * est2.Total / est.Total
est2.Main = est.Main * est2.Total / est.Total
est2.Post = est.Post * est2.Total / est.Total
est2.Version = (int)(time.Now().Unix())
optimizer.cache[jobName] = &est2
return &est2, true
}

View File

@@ -262,6 +262,7 @@ func (pool *ResourcePool) acquireNetwork() string {
for k := range pool.networksFree {
network = k
delete(pool.networksFree, k)
break
}
return network
}

View File

@@ -363,6 +363,8 @@ func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []Node
for job := range jobs {
if utilT, ok := InstanceOfOptimizer().predictUtilGPU(job); ok {
totalUtil += utilT
} else {
totalUtil += 100
}
}
if totalUtil < 100 {