[PATCH compass-ci] params_group.rb: delete $user if tbox_group has

Some tbox_groups have $user in es. Such as vm-2p8g--$user or vm-2p8g.$user. But their config is the same, they should be compared together. Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- lib/params_group.rb | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/lib/params_group.rb b/lib/params_group.rb index cde40af..6d5c47b 100644 --- a/lib/params_group.rb +++ b/lib/params_group.rb @@ -67,10 +67,17 @@ def filter_groups(groups) end end +def get_tbox_group(tbox_group) + tbox_group = tbox_group.split('--')[0] if tbox_group.include?('--') + tbox_group = tbox_group.split('.')[0] if tbox_group.include?('.') + return tbox_group +end + def get_all_params(job) all_params = {} job.each_key do |param| all_params[param] = job[param] if COMMON_PARAMS.include?(param) + all_params[param] = get_tbox_group(job[param]) if param == 'tbox_group' next unless param == 'pp' pp_params = get_pp_params(job[param]) -- 2.23.0

On Tue, Dec 01, 2020 at 10:53:29AM +0800, Li Yuanchao wrote:
Some tbox_groups have $user in es. Such as vm-2p8g--$user or vm-2p8g.$user. But their config is the same, they should be compared together.
Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- lib/params_group.rb | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/lib/params_group.rb b/lib/params_group.rb index cde40af..6d5c47b 100644 --- a/lib/params_group.rb +++ b/lib/params_group.rb @@ -67,10 +67,17 @@ def filter_groups(groups) end end
+def get_tbox_group(tbox_group) + tbox_group = tbox_group.split('--')[0] if tbox_group.include?('--') + tbox_group = tbox_group.split('.')[0] if tbox_group.include?('.') + return tbox_group
you can use gsub to replace the "--.*$" and "\..*$" to '' example: tbox_group.gsub(/(--|\.).*$/, '') and you can merge the three line to one Thanks, Luan Shengde
+end + def get_all_params(job) all_params = {} job.each_key do |param| all_params[param] = job[param] if COMMON_PARAMS.include?(param) + all_params[param] = get_tbox_group(job[param]) if param == 'tbox_group' next unless param == 'pp'
pp_params = get_pp_params(job[param]) -- 2.23.0

On Tue, Dec 01, 2020 at 11:35:24AM +0800, Luan Shengde wrote:
On Tue, Dec 01, 2020 at 10:53:29AM +0800, Li Yuanchao wrote:
Some tbox_groups have $user in es. Such as vm-2p8g--$user or vm-2p8g.$user. But their config is the same, they should be compared together.
Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- lib/params_group.rb | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/lib/params_group.rb b/lib/params_group.rb index cde40af..6d5c47b 100644 --- a/lib/params_group.rb +++ b/lib/params_group.rb @@ -67,10 +67,17 @@ def filter_groups(groups) end end
+def get_tbox_group(tbox_group) + tbox_group = tbox_group.split('--')[0] if tbox_group.include?('--') + tbox_group = tbox_group.split('.')[0] if tbox_group.include?('.') + return tbox_group
you can use gsub to replace the "--.*$" and "\..*$" to '' example: tbox_group.gsub(/(--|\.).*$/, '') and you can merge the three line to one
ok Thanks, Yuanchao

This looks a hack. Users shall not append $user to tbox_group, unless they purposely don't want be compared with others. Is that the case? If not, we may forbid appending $user at submit time. By changing this logic hosts_file_name = @job['tbox_group'].split(/\.|--/)[0] in get_hosts_file(). Thanks, Fengguang On Tue, Dec 01, 2020 at 10:53:29AM +0800, Li Yuanchao wrote:
Some tbox_groups have $user in es. Such as vm-2p8g--$user or vm-2p8g.$user. But their config is the same, they should be compared together.
Signed-off-by: Li Yuanchao <lyc163mail@163.com> --- lib/params_group.rb | 7 +++++++ 1 file changed, 7 insertions(+)
diff --git a/lib/params_group.rb b/lib/params_group.rb index cde40af..6d5c47b 100644 --- a/lib/params_group.rb +++ b/lib/params_group.rb @@ -67,10 +67,17 @@ def filter_groups(groups) end end
+def get_tbox_group(tbox_group) + tbox_group = tbox_group.split('--')[0] if tbox_group.include?('--') + tbox_group = tbox_group.split('.')[0] if tbox_group.include?('.') + return tbox_group +end + def get_all_params(job) all_params = {} job.each_key do |param| all_params[param] = job[param] if COMMON_PARAMS.include?(param) + all_params[param] = get_tbox_group(job[param]) if param == 'tbox_group' next unless param == 'pp'
pp_params = get_pp_params(job[param]) -- 2.23.0

On Wed, Dec 02, 2020 at 09:21:08AM +0800, Wu Fengguang wrote:
This looks a hack. Users shall not append $user to tbox_group, unless they purposely don't want be compared with others.
Is that the case? If not, we may forbid appending $user at submit time. By changing this logic
hosts_file_name = @job['tbox_group'].split(/\.|--/)[0]
in get_hosts_file().
I think they may do this by mistake. But there are such data in es. I'll change the get_hosts_file() to forbid appending $user at submit time Thanks, Yuanchao
participants (3)
-
Li Yuanchao
-
Luan Shengde
-
Wu Fengguang