Idle job will be submitted when there's no job to consume, so move this function to 'find_job_boot.cr'.
Refactor this function for subqueue: for idle job, subqueue is 'idle'.
Signed-off-by: Ren Wen 15991987063@163.com --- src/lib/sched.cr | 14 -------------- src/scheduler/find_job_boot.cr | 7 +++++++ 2 files changed, 7 insertions(+), 14 deletions(-)
diff --git a/src/lib/sched.cr b/src/lib/sched.cr index 10a51ab..a1ef28e 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -67,20 +67,6 @@ class Sched @redis.hash_del("sched/host2queues", hostname) end
- def auto_submit_idle_job(tbox_group) - full_path_patterns = "#{ENV["CCI_REPOS"]}/lab-#{ENV["lab"]}/allot/idle/#{tbox_group}/*.yaml" - extra_job_fields = [ - "idle_job=true", - "MASTER_FLUENTD_HOST=#{ENV["MASTER_FLUENTD_HOST"]}", - "MASTER_FLUENTD_PORT=#{ENV["MASTER_FLUENTD_PORT"]}", - ] - - Jobfile::Operate.auto_submit_job( - full_path_patterns, - "testbox: #{tbox_group}", - extra_job_fields) if Dir.glob(full_path_patterns).size > 0 - end - def update_tbox_wtmp testbox = "" hash = Hash(String, String).new diff --git a/src/scheduler/find_job_boot.cr b/src/scheduler/find_job_boot.cr index fcc7ea9..d5ef505 100644 --- a/src/scheduler/find_job_boot.cr +++ b/src/scheduler/find_job_boot.cr @@ -230,4 +230,11 @@ class Sched
return job end + + private def auto_submit_idle_job(testbox) + full_path_patterns = "#{CCI_REPOS}/#{LAB_REPO}/allot/idle/#{testbox}/*.yaml" + fields = ["testbox=#{testbox}", "subqueue=idle"] + + Jobfile::Operate.auto_submit_job(full_path_patterns, fields) if Dir.glob(full_path_patterns).size > 0 + end end