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

Side by Side Diff: appengine/findit/crash/findit_for_fracas.py

Issue 2338273006: [Findit] Factoring out the components, so they can classify themselves (Closed)
Patch Set: Created 4 years, 3 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
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 """Process crashes from Chrome crash server and find culprits for them.""" 5 """Process crashes from Chrome crash server and find culprits for them."""
6 6
7 import logging 7 import logging
8 8
9 from common import chromium_deps 9 from common import chromium_deps
10 from crash import detect_regression_range 10 from crash import detect_regression_range
11 from crash import findit_for_crash 11 from crash import findit_for_crash
12 from crash.fracas_parser import FracasParser 12 from crash.fracas_parser import FracasParser
13 from crash.project_classifier import ProjectClassifier 13 from crash.project_classifier import ProjectClassifier
14 from crash.component import Component
14 from crash.component_classifier import ComponentClassifier 15 from crash.component_classifier import ComponentClassifier
15 from model.crash.crash_config import CrashConfig 16 from model.crash.crash_config import CrashConfig
16 17
17 # TODO(katesonia): Remove the default value after adding validity check to 18 # TODO(katesonia): Remove the default value after adding validity check to
18 # config. 19 # config.
19 _DEFAULT_TOP_N = 7 20 _DEFAULT_TOP_N = 7
20 21
21 22
22 def FindCulpritForChromeCrash(signature, platform, 23 def FindCulpritForChromeCrash(signature, platform,
23 stack_trace, crashed_version, historic_metadata): 24 stack_trace, crashed_version, historic_metadata):
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
113 last_good_version, first_bad_version, platform) 114 last_good_version, first_bad_version, platform)
114 115
115 crash_config = CrashConfig.Get() 116 crash_config = CrashConfig.Get()
116 culprit_results = findit_for_crash.FindItForCrash( 117 culprit_results = findit_for_crash.FindItForCrash(
117 stacktrace, regression_deps_rolls, crash_deps, crash_config.fracas.get( 118 stacktrace, regression_deps_rolls, crash_deps, crash_config.fracas.get(
118 'top_n', _DEFAULT_TOP_N)) 119 'top_n', _DEFAULT_TOP_N))
119 120
120 crash_stack = stacktrace.crash_stack 121 crash_stack = stacktrace.crash_stack
121 suspected_project = ProjectClassifier().Classify( 122 suspected_project = ProjectClassifier().Classify(
122 culprit_results, crash_stack) 123 culprit_results, crash_stack)
123 suspected_components = ComponentClassifier().Classify( 124
124 culprit_results, crash_stack) 125 component_classifier_config = CrashConfig.Get().compiled_component_classifier
126 suspected_components = ComponentClassifier(
127 # TODO(wrengr): have the config return Component objects directly,
128 # rather than needing to convert them here.
129 [ Component(component_name, path_regex, function_regex)
Martin Barbella 2016/09/19 21:17:18 Nit: no space after [
Sharu Jiang 2016/09/20 00:31:29 The path_regex, function_regex in CrashConfig.Get(
wrengr 2016/09/27 22:00:39 The current code does not recompile them. Calling
wrengr 2016/09/27 22:00:39 Done.
130 for path_regex, function_regex, component_name
131 in component_classifier_config['path_function_component'] ],
Martin Barbella 2016/09/19 21:17:18 and none before ]
stgao 2016/09/21 21:57:27 Not sure if the intent is correct here, mind a che
wrengr 2016/09/27 22:00:39 Pylint says everything is fine
wrengr 2016/09/27 22:00:39 Done.
132 component_classifier_config['top_n']
133 ).Classify(culprit_results, crash_stack)
125 134
126 # TODO(http://crbug.com/644411): the caller should convert things to 135 # TODO(http://crbug.com/644411): the caller should convert things to
127 # JSON, not us. 136 # JSON, not us.
128 culprit_results_list = [result.ToDict() for result in culprit_results] 137 culprit_results_list = [result.ToDict() for result in culprit_results]
129 138
130 return ( 139 return (
131 { 140 {
132 'found': (bool(suspected_project) or bool(suspected_components) or 141 'found': (bool(suspected_project) or bool(suspected_components) or
133 bool(culprit_results_list)), 142 bool(culprit_results_list)),
134 'regression_range': regression_versions, 143 'regression_range': regression_versions,
135 'suspected_project': suspected_project, 144 'suspected_project': suspected_project,
136 'suspected_components': suspected_components, 145 'suspected_components': suspected_components,
137 'suspected_cls': culprit_results_list, 146 'suspected_cls': culprit_results_list,
138 }, 147 },
139 { 148 {
140 'found_suspects': bool(culprit_results_list), 149 'found_suspects': bool(culprit_results_list),
141 'has_regression_range': bool(regression_versions), 150 'has_regression_range': bool(regression_versions),
142 'solution': 'core_algorithm', 151 'solution': 'core_algorithm',
143 } 152 }
144 ) 153 )
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698