On Thu, Oct 29, 2020 at 07:59:34PM +0800, Cao Xueliang wrote:
On Thu, Oct 29, 2020 at 07:56:33PM +0800, Xiao Shenwei wrote:
On Thu, Oct 29, 2020 at 07:54:21PM +0800, Yu Chuan wrote:
About subject: how about this: register 'queue' at the same time register 'hostname' to redis.
nice
That can't show the realtion between host and queues, just like do that at the same time.
nice
Thanks, Shenwei
Thanks, Xueliang
Thanks, Shenwei
Thanks Yu Chuan
On Thu, Oct 29, 2020 at 07:23:07PM +0800, Xiao Shenwei wrote:
[why] the test machine has the ability to know which queues should be requested
[how] for VM HW, we will register mac2hostname and hostname2queues. then they can find queues based on mac. API: boot.ipxe/mac/${mac}
for docker, we will register hostname2queues, then container can find queues based on hostname. API: boot.container/hostname/${hostname}
Signed-off-by: Xiao Shenwei xiaoshenwei96@163.com
src/lib/sched.cr | 8 ++++++++ src/scheduler/scheduler.cr | 24 ++++++++++++++++++++++++ 2 files changed, 32 insertions(+)
diff --git a/src/lib/sched.cr b/src/lib/sched.cr index b2ef6ce..9407ddc 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -34,10 +34,18 @@ class Sched @redis.hash_set("sched/mac2host", normalize_mac(mac), hostname) end
def set_host2queues(hostname : String, queues : String)
@redis.hash_set("sched/host2queues", hostname, queues)
end
def del_host_mac(mac : String) @redis.hash_del("sched/mac2host", normalize_mac(mac)) end
def del_host2queues(hostname : String)
@redis.hash_del("sched/host2queues", hostname)
end
# return: # Hash(String, Hash(String, String)) def get_cluster_state(cluster_id)
diff --git a/src/scheduler/scheduler.cr b/src/scheduler/scheduler.cr index 371e4ed..a946ea0 100644 --- a/src/scheduler/scheduler.cr +++ b/src/scheduler/scheduler.cr @@ -113,6 +113,18 @@ module Scheduler end end
- # curl -X PUT "http://localhost:3000/set_host2queues?queues=vm-2p8g.aarch64&host=vm-2p8..."
- put "/set_host2queues" do |env|
- env.response.headers["Connection"] = "close"
- if (client_queues = env.params.query["queues"]?) && (client_host = env.params.query["host"]?)
sched.set_host2queues(client_host, client_queues)
"Done"
- else
"No yet"
- end
- end
- # curl -X PUT "http://localhost:3000/del_host_mac?mac=00-01-02-03-04-05" put "/del_host_mac" do |env| env.response.headers["Connection"] = "close"
@@ -125,6 +137,18 @@ module Scheduler end end
- # curl -X PUT "http://localhost:3000/del_host2queues?host=vm-2p8g.aarch64"
- put "/del_host2queues" do |env|
- env.response.headers["Connection"] = "close"
- if client_host = env.params.query["host"]?
sched.del_host2queues(client_host)
"Done"
- else
"No yet!"
- end
- end
- # client(runner) report job's status # /~lkp/cgi-bin/lkp-jobfile-append-var # ?job_file=/lkp/scheduled/job.yaml&job_state=running&job_id=10
-- 2.23.0