mirror of
https://github.com/newnius/YAO-scheduler.git
synced 2025-12-13 07:46:43 +00:00
update scheduler_priority
This commit is contained in:
@@ -3,8 +3,8 @@ package main
|
|||||||
type JobPriority int
|
type JobPriority int
|
||||||
|
|
||||||
const (
|
const (
|
||||||
Low JobPriority = iota
|
Low JobPriority = 1
|
||||||
Medium
|
Medium JobPriority = 25
|
||||||
Hight
|
Hight JobPriority = 50
|
||||||
Urgent
|
Urgent JobPriority = 99
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -103,6 +103,7 @@ func (scheduler *SchedulerPriority) Schedule(job Job) {
|
|||||||
right = mid - 1
|
right = mid - 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
fmt.Println(index)
|
||||||
scheduler.queue = append(scheduler.queue, Job{})
|
scheduler.queue = append(scheduler.queue, Job{})
|
||||||
|
|
||||||
copy(scheduler.queue[index+1:], scheduler.queue[index:])
|
copy(scheduler.queue[index+1:], scheduler.queue[index:])
|
||||||
|
|||||||
22
src/util.go
22
src/util.go
@@ -113,17 +113,17 @@ type NodeStatus struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type Job struct {
|
type Job struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
Tasks []Task `json:"tasks"`
|
Tasks []Task `json:"tasks"`
|
||||||
Workspace string `json:"workspace"`
|
Workspace string `json:"workspace"`
|
||||||
Cluster int `json:"virtual_cluster"`
|
Cluster int `json:"virtual_cluster"`
|
||||||
Priority int `json:"priority"`
|
Priority JobPriority `json:"priority"`
|
||||||
RunBefore int `json:"run_before"`
|
RunBefore int `json:"run_before"`
|
||||||
CreatedAt int `json:"created_at"`
|
CreatedAt int `json:"created_at"`
|
||||||
UpdatedAt int `json:"updated_at"`
|
UpdatedAt int `json:"updated_at"`
|
||||||
CreatedBy int `json:"created_by"`
|
CreatedBy int `json:"created_by"`
|
||||||
Status State `json:"status"`
|
Status State `json:"status"`
|
||||||
}
|
}
|
||||||
|
|
||||||
type Task struct {
|
type Task struct {
|
||||||
|
|||||||
Reference in New Issue
Block a user