
On Mon, Oct 19, 2020 at 03:56:41PM +0800, Zhang Yuhang wrote:
On Mon, Oct 19, 2020 at 12:10:46PM +0800, Ren Wen wrote:
1) when a job without 'cluster' (a job field), or has 'cluster' but starts with 'cs-localhost', the job is a normal job; otherwise, it's a cluster job.
2) alter the numbers of return values of 'get_cluster_config' function, to only return 'cluster config'. Because the conditions how to judge a job is whether a cluster job are changed.
Signed-off-by: Ren Wen <15991987063@163.com> --- src/lib/sched.cr | 33 ++++++++++++--------------------- 1 file changed, 12 insertions(+), 21 deletions(-)
job = Job.new(job_content, job_content["id"]?)
job = Job.new(job_content, job_content["id"]?) ^ What this "?" mean in here? Thanks.
It's a part of instance method, 'Job' here is a class in '$CCI_SRC/src/lib/job.cr': ``` def []?(key : String) @hash.[key]? end ``` Thanks, RenWen
Thanks, Zhang Yuhang
job["commit_date"] = get_commit_date(job)
+ # it is not a cluster job if cluster field is empty or + # field's prefix is 'cs-localhost' cluster_file = job["cluster"] - if cluster_file != "" - cluster_config, hosts_size = get_cluster_config( - cluster_file, job.lkp_initrd_user, job.os_arch) - - return submit_cluster_job( - job, cluster_config.not_nil!) if hosts_size >= 2 + if cluster_file.empty? || cluster_file.starts_with?("cs-localhost") + return submit_single_job(job) + else + cluster_config = get_cluster_config(cluster_file, + job.lkp_initrd_user, + job.os_arch) + return submit_cluster_job(job, cluster_config) end - - return submit_single_job(job) rescue ex puts ex.inspect_with_backtrace return [{ -- 2.23.0