Use testbox to find and submit idle jobs because of different types of physical machines have different jobs.
Before: find and submit idle jobs using tbox_group queues. Now: find and submit using testbox queues.
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
- 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)
What's the different with when job.nil call prepare_job? Thanks, Xueliang
# 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}",
end"testbox: #{tbox}", extra_job_fields) if Dir.glob(full_path_patterns).size > 0
-- 2.23.0
On Wed, Oct 14, 2020 at 02:27:11PM +0800, Cao Xueliang wrote:
- 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)
What's the different with when job.nil call prepare_job?
Submit all idle jobs. Next time will find directly without submitting again.
Thanks, RenWen
Thanks, Xueliang
# 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}",
end"testbox: #{tbox}", extra_job_fields) if Dir.glob(full_path_patterns).size > 0
-- 2.23.0
On Wed, Oct 14, 2020 at 02:22:02PM +0800, Ren Wen wrote:
Use testbox to find and submit idle jobs because of different types of physical machines have different jobs.
Before: find and submit idle jobs using tbox_group queues. Now: find and submit using testbox queues.
Can you give concrete example?
Thanks, Fengguang
On Wed, Oct 14, 2020 at 02:31:14PM +0800, Wu Fengguang wrote:
On Wed, Oct 14, 2020 at 02:22:02PM +0800, Ren Wen wrote:
Use testbox to find and submit idle jobs because of different types of physical machines have different jobs.
Before: find and submit idle jobs using tbox_group queues. Now: find and submit using testbox queues.
Can you give concrete example?
Yes, i'll do that.
Thanks, RenWen
Thanks, Fengguang