Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(18)

Side by Side Diff: appengine/findit/handlers/handlers_util.py

Issue 2027333002: [Findit] don't included skipped or unknown tests in swarming tasks into failed tests. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: . Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | appengine/findit/handlers/test/handlers_util_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # Copyright 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be 2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file. 3 # found in the LICENSE file.
4 4
5 from collections import defaultdict 5 from collections import defaultdict
6 import copy 6 import copy
7 7
8 from handlers import result_status 8 from handlers import result_status
9 from model import analysis_status 9 from model import analysis_status
10 from model.wf_analysis import WfAnalysis 10 from model.wf_analysis import WfAnalysis
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
79 for step_name, failure in failure_result_map.iteritems(): 79 for step_name, failure in failure_result_map.iteritems():
80 step_tasks_info = tasks_info[step_name]['swarming_tasks'] 80 step_tasks_info = tasks_info[step_name]['swarming_tasks']
81 if isinstance(failure, dict): 81 if isinstance(failure, dict):
82 # Only swarming test failures have swarming re-runs. 82 # Only swarming test failures have swarming re-runs.
83 swarming_task_keys = set(failure.values()) 83 swarming_task_keys = set(failure.values())
84 84
85 for key in swarming_task_keys: 85 for key in swarming_task_keys:
86 task_dict = step_tasks_info[key] 86 task_dict = step_tasks_info[key]
87 referred_build_keys = key.split('/') 87 referred_build_keys = key.split('/')
88 task = WfSwarmingTask.Get(*referred_build_keys, step_name=step_name) 88 task = WfSwarmingTask.Get(*referred_build_keys, step_name=step_name)
89 all_tests = _GetAllTestsForASwarmingTask(key, failure)
90 task_dict['all_tests'] = all_tests
89 if not task: # In case task got manually removed from data store. 91 if not task: # In case task got manually removed from data store.
90 task_info = { 92 task_info = {
91 'status': result_status.NO_SWARMING_TASK_FOUND 93 'status': result_status.NO_SWARMING_TASK_FOUND
92 } 94 }
93 task_dict['all_tests'] = _GetAllTestsForASwarmingTask(key, failure)
94 else: 95 else:
95 task_info = { 96 task_info = {
96 'status': task.status 97 'status': task.status
97 } 98 }
98 99
99 task_dict['all_tests'] = (
100 _GetAllTestsForASwarmingTask(key, failure)
101 if not (task.parameters and task.parameters.get('tests'))
102 else task.parameters['tests'])
103
104 # Get the step name without platform. 100 # Get the step name without platform.
105 # This value should have been saved in task.parameters; 101 # This value should have been saved in task.parameters;
106 # in case of no such value saved, split the step_name. 102 # in case of no such value saved, split the step_name.
107 task_dict['ref_name'] = ( 103 task_dict['ref_name'] = (
108 step_name.split()[0] 104 step_name.split()[0]
109 if not task.parameters or not task.parameters.get('ref_name') 105 if not task.parameters or not task.parameters.get('ref_name')
110 else task.parameters['ref_name']) 106 else task.parameters['ref_name'])
111 107
112 if task.task_id: # Swarming rerun has started. 108 if task.task_id: # Swarming rerun has started.
113 task_info['task_id'] = task.task_id 109 task_info['task_id'] = task.task_id
114 task_info['task_url'] = 'https://%s/user/task/%s' % ( 110 task_info['task_url'] = 'https://%s/user/task/%s' % (
115 swarming_server, task.task_id) 111 swarming_server, task.task_id)
116 if task.classified_tests: 112 if task.classified_tests:
117 # Swarming rerun has completed. 113 # Swarming rerun has completed.
118 # Use its result to get reliable and flaky tests. 114 # Use its result to get reliable and flaky tests.
119 # If task has not completed, there will be no try job yet, 115 # If task has not completed, there will be no try job yet,
120 # the result will be grouped in unclassified failures temporarily. 116 # the result will be grouped in unclassified failures temporarily.
121 task_dict['reliable_tests'] = task.classified_tests.get( 117 reliable_tests = task.classified_tests.get('reliable_tests', [])
122 'reliable_tests', []) 118 task_dict['reliable_tests'] = [
123 task_dict['flaky_tests'] = task.classified_tests.get( 119 test for test in reliable_tests if test in all_tests]
124 'flaky_tests', []) 120 flaky_tests = task.classified_tests.get('flaky_tests', [])
121 task_dict['flaky_tests'] = [
122 test for test in flaky_tests if test in all_tests]
125 123
126 task_dict['task_info'] = task_info 124 task_dict['task_info'] = task_info
127 else: 125 else:
128 step_tasks_info[failure] = { 126 step_tasks_info[failure] = {
129 'task_info': { 127 'task_info': {
130 'status': result_status.NON_SWARMING_NO_RERUN 128 'status': result_status.NON_SWARMING_NO_RERUN
131 } 129 }
132 } 130 }
133 131
134 return tasks_info 132 return tasks_info
(...skipping 287 matching lines...) Expand 10 before | Expand all | Expand 10 after
422 420
423 culprits_info[step_name] = { 421 culprits_info[step_name] = {
424 'try_jobs': [ 422 'try_jobs': [
425 { 423 {
426 'status': result_status.NO_FAILURE_RESULT_MAP, 424 'status': result_status.NO_FAILURE_RESULT_MAP,
427 'tests': tests 425 'tests': tests
428 } 426 }
429 ] 427 ]
430 } 428 }
431 return culprits_info 429 return culprits_info
OLDNEW
« no previous file with comments | « no previous file | appengine/findit/handlers/test/handlers_util_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698