1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-06-07 14:21:55 +00:00
This commit is contained in:
Newnius 2020-05-04 00:17:59 +08:00
parent 4c4fe67ee0
commit dbe02d12ee
2 changed files with 6 additions and 5 deletions

View File

@ -14,7 +14,7 @@ import (
type ResourcePool struct { type ResourcePool struct {
poolsCount int poolsCount int
pools []PoolSeg //pools []PoolSeg
poolsMu sync.Mutex poolsMu sync.Mutex
history []PoolStatus history []PoolStatus
@ -165,7 +165,7 @@ func (pool *ResourcePool) saveStatusHistory() {
nodesCount += len(cur.Nodes) nodesCount += len(cur.Nodes)
cur.Lock.Unlock() cur.Lock.Unlock()
cur = cur.Next cur = cur.Next
if cur == start { if cur.ID == start.ID {
break break
} }
} }
@ -249,6 +249,7 @@ func (pool *ResourcePool) update(node NodeStatus) {
/* spilt seg */ /* spilt seg */
func (pool *ResourcePool) scaleSeg(seg *PoolSeg) { func (pool *ResourcePool) scaleSeg(seg *PoolSeg) {
log.Info("Scaling seg ", seg.ID)
go func() { go func() {
pool.poolsMu.Lock() pool.poolsMu.Lock()
defer pool.poolsMu.Unlock() defer pool.poolsMu.Unlock()

View File

@ -353,7 +353,7 @@ func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []Node
for cur := start; ; { for cur := start; ; {
if _, ok := locks[cur.ID]; !ok { if _, ok := locks[cur.ID]; !ok {
log.Info("lock", cur.ID) log.Info("lock ", cur.ID)
cur.Lock.Lock() cur.Lock.Lock()
locks[cur.ID] = cur.Lock locks[cur.ID] = cur.Lock
} }
@ -403,7 +403,7 @@ func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []Node
allocationType = 2 allocationType = 2
for cur := start; ; { for cur := start; ; {
if _, ok := locks[cur.ID]; !ok { if _, ok := locks[cur.ID]; !ok {
log.Info("lock", cur.ID) log.Info("lock ", cur.ID)
cur.Lock.Lock() cur.Lock.Lock()
locks[cur.ID] = cur.Lock locks[cur.ID] = cur.Lock
} }
@ -445,7 +445,7 @@ func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []Node
allocationType = 3 allocationType = 3
for cur := start; ; { for cur := start; ; {
if _, ok := locks[cur.ID]; !ok { if _, ok := locks[cur.ID]; !ok {
log.Info("lock", cur.ID) log.Info("lock ", cur.ID)
cur.Lock.Lock() cur.Lock.Lock()
locks[cur.ID] = cur.Lock locks[cur.ID] = cur.Lock
} }