diff --git a/src/job_priority.go b/src/job_priority.go index 8dc0143..ac89d64 100644 --- a/src/job_priority.go +++ b/src/job_priority.go @@ -3,8 +3,8 @@ package main type JobPriority int const ( - Low JobPriority = iota - Medium - Hight - Urgent + Low JobPriority = 1 + Medium JobPriority = 25 + Hight JobPriority = 50 + Urgent JobPriority = 99 ) diff --git a/src/scheduler_priority.go b/src/scheduler_priority.go index 77812d6..91405a8 100644 --- a/src/scheduler_priority.go +++ b/src/scheduler_priority.go @@ -103,6 +103,7 @@ func (scheduler *SchedulerPriority) Schedule(job Job) { right = mid - 1 } } + fmt.Println(index) scheduler.queue = append(scheduler.queue, Job{}) copy(scheduler.queue[index+1:], scheduler.queue[index:]) diff --git a/src/util.go b/src/util.go index a32116e..c2cf6b7 100644 --- a/src/util.go +++ b/src/util.go @@ -113,17 +113,17 @@ type NodeStatus struct { } type Job struct { - ID int `json:"id"` - Name string `json:"name"` - Tasks []Task `json:"tasks"` - Workspace string `json:"workspace"` - Cluster int `json:"virtual_cluster"` - Priority int `json:"priority"` - RunBefore int `json:"run_before"` - CreatedAt int `json:"created_at"` - UpdatedAt int `json:"updated_at"` - CreatedBy int `json:"created_by"` - Status State `json:"status"` + ID int `json:"id"` + Name string `json:"name"` + Tasks []Task `json:"tasks"` + Workspace string `json:"workspace"` + Cluster int `json:"virtual_cluster"` + Priority JobPriority `json:"priority"` + RunBefore int `json:"run_before"` + CreatedAt int `json:"created_at"` + UpdatedAt int `json:"updated_at"` + CreatedBy int `json:"created_by"` + Status State `json:"status"` } type Task struct {