Save data like this "queues":["sched/dc-1g~wuzhende/ready"] to ES. So we can collect testbox information of a queue.
Signed-off-by: Wu Zhende wuzhende666@163.com --- src/lib/sched.cr | 6 ++++-- src/scheduler/find_job_boot.cr | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
diff --git a/src/lib/sched.cr b/src/lib/sched.cr index 6fd6657..c84b3f3 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -143,7 +143,7 @@ class Sched @log.warn(e) end
- def set_lifecycle(job, testbox) + def set_lifecycle(job, testbox, queues) if job deadline = job.get_deadline job["deadline"] = deadline @@ -156,11 +156,13 @@ class Sched state = "requesting" end
+ queues = JSON.parse(queues.to_json) hash = { "job_id" => job_id, "state" => state, "time" => get_time, - "deadline" => deadline + "deadline" => deadline, + "queues" => queues } @redis.update_wtmp(testbox.to_s, hash) @es.update_tbox(testbox.to_s, hash) diff --git a/src/scheduler/find_job_boot.cr b/src/scheduler/find_job_boot.cr index 6e8d5d1..ff88d32 100644 --- a/src/scheduler/find_job_boot.cr +++ b/src/scheduler/find_job_boot.cr @@ -182,7 +182,7 @@ class Sched def get_job_boot(host, boot_type) queues = get_queues(host) job = get_job_from_queues(queues, host) - set_lifecycle(job, host) + set_lifecycle(job, host, queues)
if job @es.set_job_content(job)