[PATCH compass-ci] scheduler: refactor function 'auto_submit_job'

Now can use an array contains all fields you want to add. Example: auto_submit_job("job.yaml", ["field01=value01", "field02=value02", ...]) Signed-off-by: Ren Wen <15991987063@163.com> --- src/scheduler/find_job_boot.cr | 2 +- src/scheduler/jobfile_operate.cr | 7 ++++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/src/scheduler/find_job_boot.cr b/src/scheduler/find_job_boot.cr index 5a11523..fcc7ea9 100644 --- a/src/scheduler/find_job_boot.cr +++ b/src/scheduler/find_job_boot.cr @@ -33,7 +33,7 @@ class Sched Jobfile::Operate.auto_submit_job( "#{ENV["LKP_SRC"]}/jobs/host-info.yaml", - "testbox: #{host}") + ["testbox=#{host}"]) end def rand_queues(queues) diff --git a/src/scheduler/jobfile_operate.cr b/src/scheduler/jobfile_operate.cr index df79d3b..65d9b17 100644 --- a/src/scheduler/jobfile_operate.cr +++ b/src/scheduler/jobfile_operate.cr @@ -61,10 +61,11 @@ module Jobfile::Operate return target_path end - def self.auto_submit_job(job_file, override_parameter, other_parameters = nil) + # *fields* should be: ["field01=value01", "field02=value02", ...] + def self.auto_submit_job(job_file, fields : Array(String) = ["testbox=vm-2p8g"]) cmd = "#{ENV["LKP_SRC"]}/sbin/submit " - cmd += other_parameters.join(" ") if other_parameters - cmd += " -s '#{override_parameter}' #{job_file}" + cmd += "#{job_file} " + cmd += fields.join(" ") puts `#{cmd}` end end -- 2.23.0
participants (1)
-
Ren Wen