[PATCH lkp-tests] lib/job.rb: merge overrides in advance

[why] we have a new job yaml like: override: nr_task: - 100% - 50% << : jobs/unixbench.yaml overrides args:[100%, 50%] shoule be add job at the first time, so it will split to atomic job, nr_task:[nr_cpu*100%, nr_cpu*50%] job has overrides, so del revise_hash(job, deepcopy(@overrides), true), otherwise it will override job with nr_task:[100%, 50%], expand_params can not deal this list directly. Signed-off-by: Wei Jihui <weijihuiall@163.com> --- lib/job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/job.rb b/lib/job.rb index 2fd4567e..bca0a100 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -249,6 +249,7 @@ class Job @overrides.merge!(hash['override']){ |_key, a, _b| a} hash.delete('override') end + hash.merge!(@overrides) @jobs << hash end rescue StandardError => e @@ -404,7 +405,6 @@ class Job i = include_files job = deepcopy(@job) revise_hash(job, deepcopy(@job2), true) - revise_hash(job, deepcopy(@overrides), true) job['___'] = nil @jobx = job if @job.include?(:expand_params) -- 2.23.0

We should write some few spec tests (also serve as live doc) to - 让我们自己安心 - 让用户对Job语义一目了然 Thanks, Fengguang On Tue, Oct 20, 2020 at 11:19:29AM +0800, Wei Jihui wrote:
[why] we have a new job yaml like: override: nr_task: - 100% - 50% << : jobs/unixbench.yaml overrides args:[100%, 50%] shoule be add job at the first time, so it will split to atomic job, nr_task:[nr_cpu*100%, nr_cpu*50%] job has overrides, so del revise_hash(job, deepcopy(@overrides), true), otherwise it will override job with nr_task:[100%, 50%], expand_params can not deal this list directly.
Signed-off-by: Wei Jihui <weijihuiall@163.com> --- lib/job.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/job.rb b/lib/job.rb index 2fd4567e..bca0a100 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -249,6 +249,7 @@ class Job @overrides.merge!(hash['override']){ |_key, a, _b| a} hash.delete('override') end + hash.merge!(@overrides) @jobs << hash end rescue StandardError => e @@ -404,7 +405,6 @@ class Job i = include_files job = deepcopy(@job) revise_hash(job, deepcopy(@job2), true) - revise_hash(job, deepcopy(@overrides), true) job['___'] = nil @jobx = job if @job.include?(:expand_params) -- 2.23.0
participants (2)
-
Wei Jihui
-
Wu Fengguang