Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 import logging | 5 import logging |
| 6 | 6 |
| 7 from google.appengine.ext import ndb | 7 from google.appengine.ext import ndb |
| 8 | 8 |
| 9 from common import appengine_util | 9 from common import appengine_util |
| 10 from crash import detect_regression_range | 10 from crash import detect_regression_range |
| 11 from crash.changelist_classifier import ChangelistClassifier | 11 from crash.changelist_classifier import ChangelistClassifier |
| 12 from crash.chromecrash_parser import ChromeCrashParser | 12 from crash.chromecrash_parser import ChromeCrashParser |
| 13 from crash.component_classifier import Component | 13 from crash.component import Component |
| 14 from crash.component_classifier import ComponentClassifier | 14 from crash.component_classifier import ComponentClassifier |
| 15 from crash.findit import Findit | 15 from crash.findit import Findit |
| 16 from crash.predator import Predator | 16 from crash.predator import Predator |
| 17 from crash.project import Project | |
| 17 from crash.project_classifier import ProjectClassifier | 18 from crash.project_classifier import ProjectClassifier |
| 18 from crash.type_enums import CrashClient | 19 from crash.type_enums import CrashClient |
| 19 from model.crash.cracas_crash_analysis import CracasCrashAnalysis | 20 from model.crash.cracas_crash_analysis import CracasCrashAnalysis |
| 20 from model.crash.crash_config import CrashConfig | 21 from model.crash.crash_config import CrashConfig |
| 21 from model.crash.fracas_crash_analysis import FracasCrashAnalysis | 22 from model.crash.fracas_crash_analysis import FracasCrashAnalysis |
| 22 | 23 |
| 23 # TODO(katesonia): Remove the default value after adding validity check to | 24 # TODO(katesonia): Remove the default value after adding validity check to |
| 24 # config. | 25 # config. |
| 25 _FRACAS_FEEDBACK_URL_TEMPLATE = 'https://%s/crash/fracas-result-feedback?key=%s' | 26 _FRACAS_FEEDBACK_URL_TEMPLATE = 'https://%s/crash/fracas-result-feedback?key=%s' |
| 26 | 27 |
| (...skipping 17 matching lines...) Expand all Loading... | |
| 44 else: | 45 else: |
| 45 logging.warning( | 46 logging.warning( |
| 46 'FinditForChromeCrash subclass %s forgot to implement _ClientID', | 47 'FinditForChromeCrash subclass %s forgot to implement _ClientID', |
| 47 cls.__name__) | 48 cls.__name__) |
| 48 raise NotImplementedError() | 49 raise NotImplementedError() |
| 49 | 50 |
| 50 # TODO(http://crbug.com/659354): remove the dependency on CrashConfig | 51 # TODO(http://crbug.com/659354): remove the dependency on CrashConfig |
| 51 # entirely, by passing the relevant data as arguments to this constructor. | 52 # entirely, by passing the relevant data as arguments to this constructor. |
| 52 def __init__(self, get_repository): | 53 def __init__(self, get_repository): |
| 53 super(FinditForChromeCrash, self).__init__(get_repository) | 54 super(FinditForChromeCrash, self).__init__(get_repository) |
| 55 project_classifier_config = CrashConfig.Get().project_classifier | |
| 54 component_classifier_config = CrashConfig.Get().component_classifier | 56 component_classifier_config = CrashConfig.Get().component_classifier |
| 55 | 57 |
| 56 self._stacktrace_parser = ChromeCrashParser() | 58 self._stacktrace_parser = ChromeCrashParser() |
| 57 | 59 |
| 60 projects = [Project(name, path_regexs, function_regexs, host_directories) | |
|
wrengr
2017/01/30 19:14:19
Since the order of the tuple/arguments is the same
Sharu Jiang
2017/01/30 22:23:52
It turned out that we cannot do that, but we can d
wrengr
2017/01/30 22:30:58
yeah, that's pretty gross. oh well
| |
| 61 for name, path_regexs, function_regexs, host_directories | |
| 62 in project_classifier_config['project_path_function_hosts']] | |
| 63 components = [Component(component_name, path_regex, function_regex) | |
| 64 for path_regex, function_regex, component_name | |
| 65 in component_classifier_config['path_function_component']], | |
| 58 # The top_n is the number of components we should return as | 66 # The top_n is the number of components we should return as |
| 59 # components suggestion results. | 67 # components suggestion results. |
| 60 # TODO(http://crbug.com/679964) Deprecate the scorer-based changelist | 68 # TODO(http://crbug.com/679964) Deprecate the scorer-based changelist |
| 61 # classifier and use loglinear model instead. | 69 # classifier and use loglinear model instead. |
| 62 self._predator = Predator( | 70 self._predator = Predator( |
| 63 cl_classifier = ChangelistClassifier(get_repository), | 71 cl_classifier = ChangelistClassifier(get_repository), |
| 64 component_classifier = ComponentClassifier( | 72 component_classifier = ComponentClassifier( |
| 65 [Component(component_name, path_regex, function_regex) | 73 components, component_classifier_config['top_n']), |
| 66 for path_regex, function_regex, component_name | 74 project_classifier = ProjectClassifier( |
| 67 in component_classifier_config['path_function_component']], | 75 projects, project_classifier_config['top_n'], |
| 68 component_classifier_config['top_n']), | 76 project_classifier_config['non_chromium_project_rank_priority'])) |
| 69 project_classifier = ProjectClassifier()) | |
| 70 | 77 |
| 71 def _InitializeAnalysis(self, model, crash_data): | 78 def _InitializeAnalysis(self, model, crash_data): |
| 72 super(FinditForChromeCrash, self)._InitializeAnalysis(model, crash_data) | 79 super(FinditForChromeCrash, self)._InitializeAnalysis(model, crash_data) |
| 73 # TODO(wrengr): see Note#1 | 80 # TODO(wrengr): see Note#1 |
| 74 customized_data = crash_data.get('customized_data', {}) | 81 customized_data = crash_data.get('customized_data', {}) |
| 75 model.channel = customized_data.get('channel', None) | 82 model.channel = customized_data.get('channel', None) |
| 76 model.historical_metadata = customized_data.get('historical_metadata', []) | 83 model.historical_metadata = customized_data.get('historical_metadata', []) |
| 77 | 84 |
| 78 # TODO(wrengr): see Note#1, which would allow us to lift this | 85 # TODO(wrengr): see Note#1, which would allow us to lift this |
| 79 # implementation to the Findit base class. | 86 # implementation to the Findit base class. |
| (...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 169 | 176 |
| 170 def GetAnalysis(self, crash_identifiers): | 177 def GetAnalysis(self, crash_identifiers): |
| 171 # TODO: inline FracasCrashAnalysis.Get stuff here. | 178 # TODO: inline FracasCrashAnalysis.Get stuff here. |
| 172 return FracasCrashAnalysis.Get(crash_identifiers) | 179 return FracasCrashAnalysis.Get(crash_identifiers) |
| 173 | 180 |
| 174 def ProcessResultForPublishing(self, result, key): | 181 def ProcessResultForPublishing(self, result, key): |
| 175 """Fracas specific processing of result data for publishing.""" | 182 """Fracas specific processing of result data for publishing.""" |
| 176 result['feedback_url'] = _FRACAS_FEEDBACK_URL_TEMPLATE % ( | 183 result['feedback_url'] = _FRACAS_FEEDBACK_URL_TEMPLATE % ( |
| 177 appengine_util.GetDefaultVersionHostname(), key) | 184 appengine_util.GetDefaultVersionHostname(), key) |
| 178 return result | 185 return result |
| OLD | NEW |