When do compare, after group jobs, there are many one_size group, which can not find another job to make a group. Delete such groups to save time.
But, if there is no size > 1 group, 3 one_size groups will be kept to avoid 'No Data'.
Signed-off-by: Li Yuanchao lyc163mail@163.com --- lib/matrix2.rb | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index 14e9558..0e80858 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -123,18 +123,37 @@ end def combine_group_query_data(job_list, dims) suites_hash = {} groups = auto_group(job_list, dims) + have_multi_member = multi_member?(groups) + one_size_count = 0 groups.each do |group_key, value| - suite_list = [] - value.each do |dimension_key, jobs| - groups[group_key][dimension_key], suites = create_matrix(jobs) - suite_list.concat(suites) + if value.size < 2 + one_size_count += 1 + if have_multi_member || one_size_count > 3 + groups.delete(group_key) + next + end end - suites_hash[group_key] = suite_list + get_groups_matrix(groups, group_key, value, suites_hash) end - return groups, suites_hash end
+def get_groups_matrix(groups, group_key, value, suites_hash) + suite_list = [] + value.each do |dimension_key, jobs| + groups[group_key][dimension_key], suites = create_matrix(jobs) + suite_list.concat(suites) + end + suites_hash[group_key] = suite_list +end + +def multi_member?(groups) + groups.each do |_key, value| + return true if value.size > 1 + end + return false +end + # input: # 1. query results(job_list) from es_query that will be auto group by auto_group_by_template() # 2. params from user's template include:
On Tue, Dec 29, 2020 at 03:37:53PM +0800, Li Yuanchao wrote:
When do compare, after group jobs, there are many one_size group, which can not find another job to make a group. Delete such groups to save time.
But, if there is no size > 1 group, 3 one_size groups will be kept to avoid 'No Data'.
Signed-off-by: Li Yuanchao lyc163mail@163.com
lib/matrix2.rb | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index 14e9558..0e80858 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -123,18 +123,37 @@ end def combine_group_query_data(job_list, dims) suites_hash = {} groups = auto_group(job_list, dims)
- have_multi_member = multi_member?(groups)
- one_size_count = 0 groups.each do |group_key, value|
- suite_list = []
- value.each do |dimension_key, jobs|
groups[group_key][dimension_key], suites = create_matrix(jobs)
suite_list.concat(suites)
- if value.size < 2
one_size_count += 1
if have_multi_member || one_size_count > 3
if multi_member exists in groups delete all one_size group? or keep 3 group at leaest whatever?
Thanks, Weitao
groups.delete(group_key)
next
endend
- suites_hash[group_key] = suite_list
- get_groups_matrix(groups, group_key, value, suites_hash) end
On Wed, Dec 30, 2020 at 04:27:49PM +0800, Lu Weitao wrote:
On Tue, Dec 29, 2020 at 03:37:53PM +0800, Li Yuanchao wrote:
When do compare, after group jobs, there are many one_size group, which can not find another job to make a group. Delete such groups to save time.
But, if there is no size > 1 group, 3 one_size groups will be kept to avoid 'No Data'.
Signed-off-by: Li Yuanchao lyc163mail@163.com
lib/matrix2.rb | 31 +++++++++++++++++++++++++------ 1 file changed, 25 insertions(+), 6 deletions(-)
diff --git a/lib/matrix2.rb b/lib/matrix2.rb index 14e9558..0e80858 100644 --- a/lib/matrix2.rb +++ b/lib/matrix2.rb @@ -123,18 +123,37 @@ end def combine_group_query_data(job_list, dims) suites_hash = {} groups = auto_group(job_list, dims)
- have_multi_member = multi_member?(groups)
- one_size_count = 0 groups.each do |group_key, value|
- suite_list = []
- value.each do |dimension_key, jobs|
groups[group_key][dimension_key], suites = create_matrix(jobs)
suite_list.concat(suites)
- if value.size < 2
one_size_count += 1
if have_multi_member || one_size_count > 3
if multi_member exists in groups delete all one_size group? or keep 3 group at leaest whatever?
If have multi_member group, delete all one_size groups.
Thanks, Yuanchao