[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..80cf0b0 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -38,6 +38,14 @@ class Sched @redis.hash_del("sched/mac2host", normalize_mac(mac)) end
+ def set_host2queues(hostname : String, queues : String) + @redis.hash_set("sched/host2queues", hostname, queues) + 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
On Fri, Oct 30, 2020 at 11:41:25AM +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.
There is no mac2hostname, only mac2host. ditto for 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 ++++++++++++++++++++++++
Here you define new functions/blocks in different places. Would you put them in one single file and require the file from scheduler.cr?
Refer to
[PATCH todo] scheduler: add feature decouple plan
Perhaps something like this
src/scheduler/host2queues.cr
class Sched def set_host2queues() end
def del_host2queues() end end
module Scheduler put "/set_host2queues" do |env| end
put "/del_host2queues" do |env| end end
Thanks, Fengguang
2 files changed, 32 insertions(+)
diff --git a/src/lib/sched.cr b/src/lib/sched.cr index b2ef6ce..80cf0b0 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -38,6 +38,14 @@ class Sched @redis.hash_del("sched/mac2host", normalize_mac(mac)) end
- def set_host2queues(hostname : String, queues : String)
- @redis.hash_set("sched/host2queues", hostname, queues)
- 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
On Fri, Oct 30, 2020 at 11:55:47AM +0800, Wu Fengguang wrote:
On Fri, Oct 30, 2020 at 11:41:25AM +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.
There is no mac2hostname, only mac2host. ditto for 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 ++++++++++++++++++++++++
Here you define new functions/blocks in different places. Would you put them in one single file and require the file from scheduler.cr?
Refer to
[PATCH todo] scheduler: add feature decouple plan
Perhaps something like this
src/scheduler/host2queues.cr
class Sched def set_host2queues() end
def del_host2queues() end end
module Scheduler put "/set_host2queues" do |env| end
put "/del_host2queues" do |env| end end
ok,
Thanks, Shenwei
Thanks, Fengguang
2 files changed, 32 insertions(+)
diff --git a/src/lib/sched.cr b/src/lib/sched.cr index b2ef6ce..80cf0b0 100644 --- a/src/lib/sched.cr +++ b/src/lib/sched.cr @@ -38,6 +38,14 @@ class Sched @redis.hash_del("sched/mac2host", normalize_mac(mac)) end
- def set_host2queues(hostname : String, queues : String)
- @redis.hash_set("sched/host2queues", hostname, queues)
- 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