On Mon, Feb 01, 2021 at 09:05:30AM +0800, Wu Zhende wrote:
Enable other crystal services to invoke the scheduler api.
Signed-off-by: Wu Zhende wuzhende666@163.com
src/lib/scheduler_api.cr | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) create mode 100644 src/lib/scheduler_api.cr
diff --git a/src/lib/scheduler_api.cr b/src/lib/scheduler_api.cr new file mode 100644 index 0000000..b8dd514 --- /dev/null +++ b/src/lib/scheduler_api.cr @@ -0,0 +1,19 @@ +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+require "http/client"
+# scheduler API class +class SchedulerAPI
- def initialize
- @port = ENV.has_key?("SCHED_PORT") ? ENV["SCHED_PORT"].to_i32 : 3000
- @host = ENV.has_key?("SCHED_HOST") ? ENV["SCHED_HOST"] : "172.17.0.1"
- end
- def close_job(job_id)
- client = HTTP::Client.new(@host, port: @port)
- response = client.get("/~lkp/cgi-bin/lkp-post-run?job_id=#{job_id}")
The API should be requested by sut who exec the lkp program, why the others services need request it?
Thanks, Xueliang
- client.close()
- return response
- end
+end
2.23.0