On Fri, Feb 05, 2021 at 06:44:25PM +0800, Wu Fengguang wrote:
How about giving public_service a more accurate name?
These are essentially vars that should be injected into each local testbox job as well as used by docker services.
In future there will be vars that should be injected into each remote testbox job.
How about inject_vars, it in job class, so it means inject vars to job.
Thanks, Xueliang
Thanks, Fengguang
On Fri, Feb 05, 2021 at 06:03:24PM +0800, Cao Xueliang wrote:
We add the service info use the submit script in lkp-tests, but the lkp-tests don't know the service info for a remote user, so, we add the public service info in scheduler.
Signed-off-by: Cao Xueliang caoxl78320@163.com
src/lib/job.cr | 2 ++ src/scheduler/public_service.cr | 17 +++++++++++++++++ 2 files changed, 19 insertions(+) create mode 100644 src/scheduler/public_service.cr
diff --git a/src/lib/job.cr b/src/lib/job.cr index 89c92c1..9829e81 100644 --- a/src/lib/job.cr +++ b/src/lib/job.cr @@ -9,6 +9,7 @@ require "scheduler/constants.cr" require "scheduler/jobfile_operate.cr" require "scheduler/kernel_params.cr" require "scheduler/pp_params.cr" +require "scheduler/public_service.cr" require "../scheduler/elasticsearch_client" require "./json_logger"
@@ -52,6 +53,7 @@ class Job
def initialize(job_content : JSON::Any, id) @hash = job_content.as_h
- @hash.merge!(public_service) @es = Elasticsearch::Client.new @account_info = Hash(String, JSON::Any).new @log = JSONLogger.new
diff --git a/src/scheduler/public_service.cr b/src/scheduler/public_service.cr new file mode 100644 index 0000000..e3b888b --- /dev/null +++ b/src/scheduler/public_service.cr @@ -0,0 +1,17 @@ +# SPDX-License-Identifier: MulanPSL-2.0+ +# Copyright (c) 2020 Huawei Technologies Co., Ltd. All rights reserved.
+class Job
- def public_service
- hash = Hash(String, JSON::Any).new
- yaml_any = File.open("/etc/compass-ci/defaults/public_service.yaml") do |content|
YAML.parse(content).as_h?
- end
- return hash unless yaml_any
- hash.merge!(Hash(String, JSON::Any).from_json(yaml_any.to_json))
- hash
- end
+end
2.23.0