Use testbox to find and submit idle jobs because of different types of physical machines have different type of jobs.
Before: find and submit idle jobs using tbox_group queues. Now: find and submit using testbox queues.
Example: There has a testbox: taishan200-2280-2s48p-256g--a14 Before: using 'taishan200-2280-2s48p-256g' Now: using 'taishan200-2280-2s48p-256g--a14'
Signed-off-by: Ren Wen 15991987063@163.com --- src/lib/sched.cr | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-)
diff --git a/src/lib/sched.cr b/src/lib/sched.cr index 2fbf05d..a61a57b 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -432,7 +432,7 @@ class Sched
# when find no job at "sched/#{tbox_group}" # try to get from "sched/#{tbox_group}/idle" - return get_idle_job(tbox_group, testbox) + return get_idle_job(tbox, testbox) end
private def prepare_job(queue_name, testbox) @@ -457,20 +457,21 @@ class Sched return job end
- private def get_idle_job(tbox_group, testbox) - job = prepare_job("sched/#{tbox_group}/idle", testbox) + private def get_idle_job(tbox, testbox) + queue_name = "sched/#{tbox}/idle" + job = prepare_job(queue_name, testbox)
# if there has no idle job, auto submit and get 1 if job.nil? - auto_submit_idle_job(tbox_group) - job = prepare_job("sched/#{tbox_group}/idle", testbox) + auto_submit_idle_job(tbox) + job = prepare_job(queue_name, testbox) end
return job end
- def auto_submit_idle_job(tbox_group) - full_path_patterns = "#{ENV["CCI_REPOS"]}/lab-#{ENV["lab"]}/allot/idle/#{tbox_group}/*.yaml" + def auto_submit_idle_job(tbox) + full_path_patterns = "#{ENV["CCI_REPOS"]}/lab-#{ENV["lab"]}/allot/idle/#{tbox}/*.yaml" extra_job_fields = [ "idle_job=true", "FLUENTD_SERVER_HOST=#{ENV["FLUENTD_SERVER_HOST"]}", @@ -479,7 +480,7 @@ class Sched
Jobfile::Operate.auto_submit_job( full_path_patterns, - "testbox: #{tbox_group}", + "testbox: #{tbox}", extra_job_fields) if Dir.glob(full_path_patterns).size > 0 end