1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-13 07:46:43 +00:00
This commit is contained in:
2020-05-24 21:08:07 +08:00
parent 0705c0630d
commit b63f1ba609
4 changed files with 126 additions and 0 deletions

13
src/group_models.go Normal file
View File

@@ -0,0 +1,13 @@
package main
type Group struct {
Name string `json:"name"`
Weight int `json:"weight"`
Reserved bool `json:"reserved"`
NumGPU int `json:"quota_gpu"`
MemoryGPU int `json:"quota_gpu_mem"`
CPU int `json:"quota_cpu"`
Memory int `json:"quota_mem"`
}

19
src/job_status.go Normal file
View File

@@ -0,0 +1,19 @@
package main
type JobStatus struct {
Name string
tasks map[string]TaskStatus
}
type TaskStatus struct {
Id string `json:"id"`
HostName string `json:"hostname"`
Node string `json:"node"`
Image string `json:"image"`
ImageDigest string `json:"image_digest"`
Command string `json:"command"`
CreatedAt string `json:"created_at"`
FinishedAt string `json:"finished_at"`
Status string `json:"status"`
State map[string]interface{} `json:"state"`
}

83
src/message.go Normal file
View File

@@ -0,0 +1,83 @@
package main
type MsgSubmit struct {
Code int `json:"code"`
Error string `json:"error"`
}
type MsgPoolStatusHistory struct {
Code int `json:"code"`
Error string `json:"error"`
Data []PoolStatus `json:"data"`
}
type MsgStop struct {
Code int `json:"code"`
Error string `json:"error"`
}
type MsgSummary struct {
Code int `json:"code"`
Error string `json:"error"`
JobsFinished int `json:"jobs_finished"`
JobsRunning int `json:"jobs_running"`
JobsPending int `json:"jobs_pending"`
FreeGPU int `json:"gpu_free"`
UsingGPU int `json:"gpu_using"`
}
type MsgJobList struct {
Code int `json:"code"`
Error string `json:"error"`
Jobs []Job `json:"jobs"`
}
type MsgLog struct {
Code int `json:"code"`
Error string `json:"error"`
Logs string `json:"logs"`
}
type MsgTaskStatus struct {
Code int `json:"code"`
Error string `json:"error"`
Status TaskStatus `json:"status"`
}
type MsgJobStatus struct {
Code int `json:"code"`
Error string `json:"error"`
Status []TaskStatus `json:"status"`
}
type MsgCreate struct {
Code int `json:"code"`
Error string `json:"error"`
Id string `json:"id"`
}
type MsgResource struct {
Code int `json:"code"`
Error string `json:"error"`
Resource map[string]NodeStatus `json:"resources"`
}
type MsgGroupCreate struct {
Code int `json:"code"`
Error string `json:"error"`
}
type MsgGroupList struct {
Code int `json:"code"`
Error string `json:"error"`
Groups []Group `json:"groups"`
}
type MsgOptimizerPredict struct {
Code int `json:"code"`
Error string `json:"error"`
Total int `json:"total"`
Pre int `json:"pre"`
Main int `json:"main"`
Post int `json:"post"`
}

11
src/pool_seg.go Normal file
View File

@@ -0,0 +1,11 @@
package main
import "sync"
type PoolSeg struct {
ID int
Nodes map[string]*NodeStatus
Lock sync.Mutex
Next *PoolSeg
IsVirtual bool
}