mirror of
https://github.com/newnius/YAO-scheduler.git
synced 2025-12-15 08:16:43 +00:00
update
This commit is contained in:
@@ -344,11 +344,10 @@ func (pool *ResourcePool) list() MsgResource {
|
|||||||
start := pool.pools[0].Next
|
start := pool.pools[0].Next
|
||||||
for cur := start; ; {
|
for cur := start; ; {
|
||||||
cur.Lock.Lock()
|
cur.Lock.Lock()
|
||||||
cur.Lock.Unlock()
|
|
||||||
|
|
||||||
for k, node := range cur.Nodes {
|
for k, node := range cur.Nodes {
|
||||||
nodes[k] = *node
|
nodes[k] = *node
|
||||||
}
|
}
|
||||||
|
cur.Lock.Unlock()
|
||||||
cur = cur.Next
|
cur = cur.Next
|
||||||
if cur == start {
|
if cur == start {
|
||||||
break
|
break
|
||||||
|
|||||||
@@ -333,6 +333,7 @@ func (scheduler *SchedulerFair) Schedule(job Job) {
|
|||||||
func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []NodeStatus) NodeStatus {
|
func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []NodeStatus) NodeStatus {
|
||||||
segID := rand.Intn(pool.poolsCount)
|
segID := rand.Intn(pool.poolsCount)
|
||||||
res := NodeStatus{}
|
res := NodeStatus{}
|
||||||
|
start := pool.pools[segID].Next
|
||||||
|
|
||||||
locks := map[int]sync.Mutex{}
|
locks := map[int]sync.Mutex{}
|
||||||
|
|
||||||
@@ -347,7 +348,6 @@ func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []Node
|
|||||||
allocationType = 1
|
allocationType = 1
|
||||||
if util, valid := InstanceOfOptimizer().predictUtilGPU(job.Name); valid {
|
if util, valid := InstanceOfOptimizer().predictUtilGPU(job.Name); valid {
|
||||||
|
|
||||||
start := pool.pools[segID].Next
|
|
||||||
for cur := start; ; {
|
for cur := start; ; {
|
||||||
if _, ok := locks[cur.ID]; !ok {
|
if _, ok := locks[cur.ID]; !ok {
|
||||||
cur.Lock.Lock()
|
cur.Lock.Lock()
|
||||||
@@ -397,7 +397,6 @@ func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []Node
|
|||||||
/* second round, find vacant gpu */
|
/* second round, find vacant gpu */
|
||||||
if len(candidates) == 0 {
|
if len(candidates) == 0 {
|
||||||
allocationType = 2
|
allocationType = 2
|
||||||
start := pool.pools[segID].Next
|
|
||||||
for cur := start; ; {
|
for cur := start; ; {
|
||||||
if _, ok := locks[cur.ID]; !ok {
|
if _, ok := locks[cur.ID]; !ok {
|
||||||
cur.Lock.Lock()
|
cur.Lock.Lock()
|
||||||
@@ -439,7 +438,6 @@ func (scheduler *SchedulerFair) AcquireResource(job Job, task Task, nodes []Node
|
|||||||
|
|
||||||
if pool.TotalGPU != 0 && float64(scheduler.UsingGPU)/float64(pool.TotalGPU) >= scheduler.enablePreScheduleRatio && valid {
|
if pool.TotalGPU != 0 && float64(scheduler.UsingGPU)/float64(pool.TotalGPU) >= scheduler.enablePreScheduleRatio && valid {
|
||||||
allocationType = 3
|
allocationType = 3
|
||||||
start := pool.pools[segID].Next
|
|
||||||
for cur := start; ; {
|
for cur := start; ; {
|
||||||
if _, ok := locks[cur.ID]; !ok {
|
if _, ok := locks[cur.ID]; !ok {
|
||||||
cur.Lock.Lock()
|
cur.Lock.Lock()
|
||||||
|
|||||||
Reference in New Issue
Block a user