On Sat, Jan 30, 2021 at 04:34:11PM +0800, Li Ping wrote:
[why]
- load job from result's job yaml has key "my_email", like
my_email: compass-ci-robot@qq.com my_name: compass-ci-robot lab: z9 2. load job from result's job yaml has key "SCHED_HOST" which from /etc/compass-ci/defaults/*.yaml, like SCHED_HOST: 172.168.131.2 SCHED_PORT: 3000
each of these fields needs to be reset when submit job.yaml for
Why? Please list the problem situations. That info is the most valuable part.
reprodution task. however, these fields already exist in yaml file, can not to be reload, so delete these fields when submit reproduction job.
Signed-off-by: Li Ping 1477412247@qq.com
lib/job.rb | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/lib/job.rb b/lib/job.rb index 640b25a5f..867c3d193 100755 --- a/lib/job.rb +++ b/lib/job.rb @@ -258,6 +258,13 @@ class Job @overrides.merge!(hash['override']){ |_key, a, _b| a} hash.delete('override') end
Should comment the situation here. The code is detecting that situation by detecting 'id'. Such indirections should normally be well commented.
if hash.has_key?('id')
hash.delete_if { |key, _| key == "SCHED_HOST" }
Directly delete?
hash.delete 'SCHED_HOST'
hash.delete_if { |key, _| key == "SCHED_PORT" }
hash.delete_if { |key, _| key == "my_name" }
hash.delete_if { |key, _| key == "my_email" }
hash.delete_if { |key, _| key == "lab" }
end revise_hash(hash, load_include_yamls(@default_yamls), false) unless @default_yamls.empty? revise_hash(hash, load_include_yamls(@override_yamls), true) unless @override_yamls.empty?
-- 2.23.0