[Why] if we add new field in job yaml like this: on_fail: sleep: 300 if will do not add sleep to pp
[How] when add sleep to pp, we check sleep's parent hash, not all job. it will find sleep in on_fail'keys.
Signed-off-by: Wei Jihui weijihuiall@163.com --- lib/job.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/job.rb b/lib/job.rb index 5c2c9517..50323d31 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -576,10 +576,10 @@ class Job @job[comment_to_symbol('auto generated by add_pp()')] = nil @job["pp"] = Hash.new() init_program_options() - for_each_in(@job, @referenced_programs.keys) do |_pk, h, p_n, p_args| - k = hash_key_re_string(@job, p_n, @job['pp'].keys) - if k && !@job[k].is_a?(Hash) - @job['pp'][k] = @job[k] + for_each_in(@job, @referenced_programs.keys) do |_pk, h, p_n, _p_args| + k = hash_key_re_string(h, p_n, @job['pp'].keys) + if k && !h[k].is_a?(Hash) && !h[k].nil? + @job['pp'][k] = h[k] next end options_hash = @referenced_programs[p_n]
On Tue, Nov 03, 2020 at 07:17:16PM +0800, Wei Jihui wrote:
[Why] if we add new field in job yaml like this: on_fail: sleep: 300 if will do not add sleep to pp
it will not add sleep to pp.
[How] when add sleep to pp, we check sleep's parent hash, not all job. it will find sleep in on_fail'keys.
Signed-off-by: Wei Jihui weijihuiall@163.com
lib/job.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/job.rb b/lib/job.rb index 5c2c9517..50323d31 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -576,10 +576,10 @@ class Job @job[comment_to_symbol('auto generated by add_pp()')] = nil @job["pp"] = Hash.new() init_program_options()
- for_each_in(@job, @referenced_programs.keys) do |_pk, h, p_n, p_args|
k = hash_key_re_string(@job, p_n, @job['pp'].keys)
if k && !@job[k].is_a?(Hash)
@job['pp'][k] = @job[k]
- for_each_in(@job, @referenced_programs.keys) do |_pk, h, p_n, _p_args|
k = hash_key_re_string(h, p_n, @job['pp'].keys)
if k && !h[k].is_a?(Hash) && !h[k].nil?
!h[k].nil? is awkward, how about just use h[k], and h[k] should be judged nil before 'is_a': if k && h[k] && !h[k].is_a?(Hash)
Thanks, Xijian
On Tue, Nov 03, 2020 at 07:17:16PM +0800, Wei Jihui wrote:
[Why] if we add new field in job yaml like this: on_fail: sleep: 300 if will do not add sleep to pp
有点晕。倒底是加还是不加到pp? 问题是啥?
[How] when add sleep to pp, we check sleep's parent hash, not all job. it will find sleep in on_fail'keys.
不明白。
Thanks, Fengguang
Signed-off-by: Wei Jihui weijihuiall@163.com
lib/job.rb | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/job.rb b/lib/job.rb index 5c2c9517..50323d31 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -576,10 +576,10 @@ class Job @job[comment_to_symbol('auto generated by add_pp()')] = nil @job["pp"] = Hash.new() init_program_options()
- for_each_in(@job, @referenced_programs.keys) do |_pk, h, p_n, p_args|
k = hash_key_re_string(@job, p_n, @job['pp'].keys)
if k && !@job[k].is_a?(Hash)
@job['pp'][k] = @job[k]
- for_each_in(@job, @referenced_programs.keys) do |_pk, h, p_n, _p_args|
k = hash_key_re_string(h, p_n, @job['pp'].keys)
if k && !h[k].is_a?(Hash) && !h[k].nil?
@job['pp'][k] = h[k] next end options_hash = @referenced_programs[p_n]
-- 2.23.0