1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-15 08:16:43 +00:00
This commit is contained in:
2020-04-11 11:38:04 +08:00
parent 7ed56468fd
commit 11aded3427
6 changed files with 55 additions and 0 deletions

View File

@@ -26,6 +26,8 @@ type ResourcePool struct {
counter int
counterTotal int
bindings map[string]map[string]bool
}
func (pool *ResourcePool) start() {
@@ -34,6 +36,8 @@ func (pool *ResourcePool) start() {
pool.networksFree = map[string]bool{}
pool.versions = map[string]float64{}
pool.bindings = map[string]map[string]bool{}
/* check dead nodes */
go func() {
pool.heartBeat = map[string]time.Time{}
@@ -112,6 +116,8 @@ func (pool *ResourcePool) update(node NodeStatus) {
return
}
log.Info(node.Version, "!=", pool.versions[node.ClientID])
pool.counter++
status, ok := pool.nodes[node.ClientID]
if ok {
@@ -189,3 +195,15 @@ func (pool *ResourcePool) releaseNetwork(network string) {
pool.networksFree[network] = true
pool.networkMu.Unlock()
}
func (pool *ResourcePool) attach(GPU string, job string) {
if _, ok := pool.bindings[GPU]; ok {
pool.bindings[GPU][job] = true
}
}
func (pool *ResourcePool) detach(GPU string, job string) {
if list, ok := pool.bindings[GPU]; ok {
delete(list, job)
}
}