1
0
mirror of https://github.com/newnius/YAO-scheduler.git synced 2025-12-15 16:16:44 +00:00
Files
YAO-scheduler/src/util.go

72 lines
1.7 KiB
Go
Raw Normal View History

2019-03-04 17:19:55 +08:00
package main
import (
"strconv"
2020-05-25 11:35:44 +08:00
)
2019-03-04 17:19:55 +08:00
2019-03-20 11:14:07 +08:00
type Job struct {
2020-06-18 19:50:16 +08:00
ID int `json:"id"`
Name string `json:"name"`
Tasks []Task `json:"tasks"`
Workspace string `json:"workspace"`
Group string `json:"group"`
BasePriority float64 `json:"base_priority"`
Priority JobPriority `json:"priority"`
RunBefore int `json:"run_before"`
CreatedAt int `json:"created_at"`
2020-06-30 16:16:30 +08:00
StartedAt int64 `json:"started_at"`
2020-06-18 19:50:16 +08:00
UpdatedAt int `json:"updated_at"`
CreatedBy int `json:"created_by"`
Locality int `json:"locality"`
Status State `json:"status"`
2020-06-18 19:53:10 +08:00
NumberGPU int `json:"number_GPU"`
2020-07-21 21:41:11 +08:00
Retries int `json:"retries"`
2019-03-20 11:14:07 +08:00
}
type Task struct {
2020-06-11 10:02:02 +08:00
ID string `json:"id"`
2019-03-20 11:14:07 +08:00
Name string `json:"name"`
2020-06-08 20:49:50 +08:00
Job string `json:"job_name"`
2019-04-12 17:21:09 +08:00
Image string `json:"image"`
2019-03-20 11:14:07 +08:00
Cmd string `json:"cmd"`
NumberCPU int `json:"cpu_number"`
Memory int `json:"memory"`
NumberGPU int `json:"gpu_number"`
MemoryGPU int `json:"gpu_memory"`
2020-04-30 12:13:21 +08:00
IsPS bool `json:"is_ps"`
2020-04-30 12:17:35 +08:00
ModelGPU string `json:"gpu_model"`
2019-03-04 17:19:55 +08:00
}
2020-04-30 23:06:12 +08:00
type UtilGPUTimeSeries struct {
2020-06-29 23:24:33 +08:00
Time int64 `json:"time"`
Util int `json:"util"`
2020-04-30 23:06:12 +08:00
}
2020-04-13 01:30:25 +08:00
type OptimizerJobExecutionTime struct {
2020-07-02 16:58:44 +08:00
Pre int `json:"pre"`
Post int `json:"post"`
Total int `json:"total"`
Main int `json:"main"`
Version int64 `json:"version"`
2020-04-13 01:30:25 +08:00
}
2020-04-30 16:45:43 +08:00
type OptimizerUtilGPU struct {
Util int `json:"util"`
Version int `json:"version"`
}
2020-05-24 21:07:02 +08:00
type ResourceCount struct {
NumberGPU int
MemoryGPU int
CPU int
Memory int
2020-05-03 23:32:38 +08:00
}
2020-07-21 21:41:11 +08:00
func str2int(s string, defaultValue int) int {
i, err := strconv.Atoi(s)
2019-03-04 17:19:55 +08:00
if err == nil {
return i
}
return defaultValue
}