mirror of
https://github.com/newnius/YAO-scheduler.git
synced 2025-06-07 14:21:55 +00:00
update
This commit is contained in:
parent
a1102e61db
commit
5f8766cd62
@ -102,6 +102,11 @@ GPU is occupied by which job(s)
|
|||||||
?action=pool_disable_batch
|
?action=pool_disable_batch
|
||||||
```
|
```
|
||||||
|
|
||||||
|
**UpdateBatchInterval**
|
||||||
|
```
|
||||||
|
?action=pool_set_batch_interval&interval=30
|
||||||
|
```
|
||||||
|
|
||||||
**PoolDump**
|
**PoolDump**
|
||||||
```
|
```
|
||||||
?action=debug_pool_dump
|
?action=debug_pool_dump
|
||||||
|
@ -312,6 +312,14 @@ func serverAPI(w http.ResponseWriter, r *http.Request) {
|
|||||||
w.Write(js)
|
w.Write(js)
|
||||||
break
|
break
|
||||||
|
|
||||||
|
case "pool_set_batch_interval":
|
||||||
|
log.Debug("pool_set_batch_interval")
|
||||||
|
interval := str2int(r.URL.Query().Get("interval"), 1)
|
||||||
|
js, _ := json.Marshal(InstanceOfResourcePool().SetBatchInterval(interval))
|
||||||
|
w.Header().Set("Content-Type", "application/json")
|
||||||
|
w.Write(js)
|
||||||
|
break
|
||||||
|
|
||||||
case "debug_pool_dump":
|
case "debug_pool_dump":
|
||||||
log.Debug("debug_pool_dump")
|
log.Debug("debug_pool_dump")
|
||||||
js, _ := json.Marshal(InstanceOfResourcePool().DebugDump())
|
js, _ := json.Marshal(InstanceOfResourcePool().DebugDump())
|
||||||
|
@ -66,6 +66,7 @@ type ResourcePool struct {
|
|||||||
batchJobs map[string]Job
|
batchJobs map[string]Job
|
||||||
batchMu sync.Mutex
|
batchMu sync.Mutex
|
||||||
batchAllocations map[string][]NodeStatus
|
batchAllocations map[string][]NodeStatus
|
||||||
|
batchInterval int
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pool *ResourcePool) init(conf Configuration) {
|
func (pool *ResourcePool) init(conf Configuration) {
|
||||||
@ -91,6 +92,7 @@ func (pool *ResourcePool) init(conf Configuration) {
|
|||||||
pool.enableBatch = false
|
pool.enableBatch = false
|
||||||
pool.batchAllocations = map[string][]NodeStatus{}
|
pool.batchAllocations = map[string][]NodeStatus{}
|
||||||
pool.batchJobs = map[string]Job{}
|
pool.batchJobs = map[string]Job{}
|
||||||
|
pool.batchInterval = 15
|
||||||
|
|
||||||
/* init pools */
|
/* init pools */
|
||||||
pool.poolsCount = 300
|
pool.poolsCount = 300
|
||||||
@ -128,7 +130,7 @@ func (pool *ResourcePool) init(conf Configuration) {
|
|||||||
go func() {
|
go func() {
|
||||||
/* batch allocation */
|
/* batch allocation */
|
||||||
for {
|
for {
|
||||||
time.Sleep(time.Second * 15)
|
time.Sleep(time.Second * time.Duration(pool.batchInterval))
|
||||||
if !pool.enableBatch {
|
if !pool.enableBatch {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
@ -916,7 +918,7 @@ func (pool *ResourcePool) doAcquireResource(job Job) []NodeStatus {
|
|||||||
|
|
||||||
//log.Info(tasks, factor)
|
//log.Info(tasks, factor)
|
||||||
allocation := InstanceOfAllocator().allocate(nodesT, tasks)
|
allocation := InstanceOfAllocator().allocate(nodesT, tasks)
|
||||||
log.Info(allocation)
|
//log.Info(allocation)
|
||||||
if allocation.Flags["valid"] {
|
if allocation.Flags["valid"] {
|
||||||
|
|
||||||
for range job.Tasks { //append would cause uncertain order
|
for range job.Tasks { //append would cause uncertain order
|
||||||
@ -943,7 +945,6 @@ func (pool *ResourcePool) doAcquireResource(job Job) []NodeStatus {
|
|||||||
res.ClientHost = node.ClientHost
|
res.ClientHost = node.ClientHost
|
||||||
res.NumCPU = task.NumberCPU
|
res.NumCPU = task.NumberCPU
|
||||||
res.MemTotal = task.Memory
|
res.MemTotal = task.Memory
|
||||||
/* bug */
|
|
||||||
res.Status = available[0:task.NumberGPU]
|
res.Status = available[0:task.NumberGPU]
|
||||||
available = available[task.NumberGPU:]
|
available = available[task.NumberGPU:]
|
||||||
|
|
||||||
@ -1033,6 +1034,15 @@ func (pool *ResourcePool) DisableBatch() bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (pool *ResourcePool) SetBatchInterval(interval int) bool {
|
||||||
|
if interval < 1 {
|
||||||
|
interval = 1
|
||||||
|
}
|
||||||
|
pool.batchInterval = interval
|
||||||
|
log.Info("batchInterval is updated to ", interval)
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
func (pool *ResourcePool) SetShareRatio(ratio float64) bool {
|
func (pool *ResourcePool) SetShareRatio(ratio float64) bool {
|
||||||
pool.enableShareRatio = ratio
|
pool.enableShareRatio = ratio
|
||||||
log.Info("enableShareRatio is updated to ", ratio)
|
log.Info("enableShareRatio is updated to ", ratio)
|
||||||
|
Loading…
Reference in New Issue
Block a user