Cluster config files are placed under lab repo now.
Scheduler will find cluster config files from: 1. lab repo (the major, take precedence). e.g. 'lab-z9/cluster/' 2. own lkp repo (for a quick test). e.g. 'lkp-tests/cluster/'
Add a constant 'CCI_REPOS' for using.
Signed-off-by: Ren Wen 15991987063@163.com --- src/scheduler/constants.cr | 1 + src/scheduler/submit_job.cr | 14 +++++++++++--- 2 files changed, 12 insertions(+), 3 deletions(-)
diff --git a/src/scheduler/constants.cr b/src/scheduler/constants.cr index 41f2c75..db5089d 100644 --- a/src/scheduler/constants.cr +++ b/src/scheduler/constants.cr @@ -11,6 +11,7 @@ JOB_ES_PORT_DEBUG = 9201 JOB_INDEX_TYPE = "jobs/_doc"
LAB = ENV["lab"]? || "nolab" +CCI_REPOS = ENV["CCI_REPOS"]? || "/c"
SCHED_HOST = (ENV.has_key?("SCHED_HOST") ? ENV["SCHED_HOST"] : "172.17.0.1") SCHED_PORT = (ENV.has_key?("SCHED_PORT") ? ENV["SCHED_PORT"] : 3000).to_i32 diff --git a/src/scheduler/submit_job.cr b/src/scheduler/submit_job.cr index 8871464..34daa3d 100644 --- a/src/scheduler/submit_job.cr +++ b/src/scheduler/submit_job.cr @@ -153,11 +153,19 @@ class Sched @es.set_job_content(job) end
- # get cluster config using own lkp_src cluster file, - # a hash type will be returned + # parse cluster config file from lab repo and own lkp repo, + # the prior takes precedence def get_cluster_config(cluster_file, lkp_initrd_user, os_arch) lkp_src = Jobfile::Operate.prepare_lkp_tests(lkp_initrd_user, os_arch) - cluster_file_path = Path.new(lkp_src, "cluster", cluster_file) + lkp_cluster_file_path = Path.new(lkp_src, "cluster", cluster_file) + lab_cluster_file_path = Path.new(CCI_REPOS, "lab-#{LAB}", "cluster", cluster_file) + + if File.file?(lab_cluster_file_path) + cluster_file_path = lab_cluster_file_path + else + cluster_file_path = lkp_cluster_file_path + end + return YAML.parse(File.read(cluster_file_path)) end