| 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 crash import detect_regression_range | 10 from crash import detect_regression_range |
| 10 from crash.changelist_classifier import ChangelistClassifier | 11 from crash.changelist_classifier import ChangelistClassifier |
| 11 from crash.chromecrash_parser import ChromeCrashParser | 12 from crash.chromecrash_parser import ChromeCrashParser |
| 12 from crash.component_classifier import Component | 13 from crash.component_classifier import Component |
| 13 from crash.component_classifier import ComponentClassifier | 14 from crash.component_classifier import ComponentClassifier |
| 14 from crash.findit import Findit | 15 from crash.findit import Findit |
| 15 from crash.predator import Predator | 16 from crash.predator import Predator |
| 16 from crash.project_classifier import ProjectClassifier | 17 from crash.project_classifier import ProjectClassifier |
| 17 from crash.type_enums import CrashClient | 18 from crash.type_enums import CrashClient |
| 18 from model.crash.cracas_crash_analysis import CracasCrashAnalysis | 19 from model.crash.cracas_crash_analysis import CracasCrashAnalysis |
| 19 from model.crash.crash_config import CrashConfig | 20 from model.crash.crash_config import CrashConfig |
| 20 from model.crash.fracas_crash_analysis import FracasCrashAnalysis | 21 from model.crash.fracas_crash_analysis import FracasCrashAnalysis |
| 21 | 22 |
| 22 # TODO(katesonia): Remove the default value after adding validity check to | 23 # TODO(katesonia): Remove the default value after adding validity check to |
| 23 # config. | 24 # config. |
| 24 _DEFAULT_TOP_N = 7 | 25 _DEFAULT_TOP_N = 7 |
| 25 | 26 _FRACAS_FEEDBACK_URL_TEMPLATE = '%s/crash/fracas-result-feedback?key=%s' |
| 26 | 27 |
| 27 # TODO(wrengr): [Note#1] in many places below we have to do some ugly | 28 # TODO(wrengr): [Note#1] in many places below we have to do some ugly |
| 28 # defaulting in case crash_data is missing certain keys. If we had | 29 # defaulting in case crash_data is missing certain keys. If we had |
| 29 # crash_data be a proper class, rather than an anonymous dict, then we | 30 # crash_data be a proper class, rather than an anonymous dict, then we |
| 30 # could clean all this up by having the properties themselves do the check | 31 # could clean all this up by having the properties themselves do the check |
| 31 # and return the default whenever keys are missing. This would also | 32 # and return the default whenever keys are missing. This would also |
| 32 # let us do things like have regression_range be automatically computed | 33 # let us do things like have regression_range be automatically computed |
| 33 # from historical_metadata (when historical_metadata is provided and | 34 # from historical_metadata (when historical_metadata is provided and |
| 34 # regression_range is not). | 35 # regression_range is not). |
| 35 | 36 |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 122 if blacklist_marker in signature: | 123 if blacklist_marker in signature: |
| 123 logging.info('%s signature is not supported. ' | 124 logging.info('%s signature is not supported. ' |
| 124 'No analysis is scheduled for %s', blacklist_marker, | 125 'No analysis is scheduled for %s', blacklist_marker, |
| 125 repr(crash_identifiers)) | 126 repr(crash_identifiers)) |
| 126 return None | 127 return None |
| 127 | 128 |
| 128 # TODO(wrengr): should we clone ``crash_data`` rather than mutating it? | 129 # TODO(wrengr): should we clone ``crash_data`` rather than mutating it? |
| 129 crash_data['platform'] = self.RenamePlatform(platform) | 130 crash_data['platform'] = self.RenamePlatform(platform) |
| 130 return crash_data | 131 return crash_data |
| 131 | 132 |
| 133 def ProcessResultForPublishing(self, result, key): # pragma: no cover. |
| 134 """Client specific processing of result data for publishing.""" |
| 135 # This method needs to get overwritten by subclasses FinditForCracas and |
| 136 # FinditForFracas. |
| 137 raise NotImplementedError() |
| 138 |
| 132 | 139 |
| 133 # TODO(http://crbug.com/659346): we misplaced the coverage tests; find them! | 140 # TODO(http://crbug.com/659346): we misplaced the coverage tests; find them! |
| 134 class FinditForCracas(FinditForChromeCrash): # pragma: no cover | 141 class FinditForCracas(FinditForChromeCrash): # pragma: no cover |
| 135 @classmethod | 142 @classmethod |
| 136 def _ClientID(cls): | 143 def _ClientID(cls): |
| 137 return CrashClient.CRACAS | 144 return CrashClient.CRACAS |
| 138 | 145 |
| 139 def CreateAnalysis(self, crash_identifiers): | 146 def CreateAnalysis(self, crash_identifiers): |
| 140 # TODO: inline CracasCrashAnalysis.Create stuff here. | 147 # TODO: inline CracasCrashAnalysis.Create stuff here. |
| 141 return CracasCrashAnalysis.Create(crash_identifiers) | 148 return CracasCrashAnalysis.Create(crash_identifiers) |
| 142 | 149 |
| 143 def GetAnalysis(self, crash_identifiers): | 150 def GetAnalysis(self, crash_identifiers): |
| 144 # TODO: inline CracasCrashAnalysis.Get stuff here. | 151 # TODO: inline CracasCrashAnalysis.Get stuff here. |
| 145 return CracasCrashAnalysis.Get(crash_identifiers) | 152 return CracasCrashAnalysis.Get(crash_identifiers) |
| 146 | 153 |
| 154 def ProcessResultForPublishing(self, result, key): # pragma: no cover. |
| 155 """Cracas specific processing of result data for publishing.""" |
| 156 # TODO(katesonia) Add feedback page link information to result after |
| 157 # feedback page of Cracas is added. |
| 158 return result |
| 159 |
| 147 | 160 |
| 148 class FinditForFracas(FinditForChromeCrash): | 161 class FinditForFracas(FinditForChromeCrash): |
| 149 @classmethod | 162 @classmethod |
| 150 def _ClientID(cls): | 163 def _ClientID(cls): |
| 151 return CrashClient.FRACAS | 164 return CrashClient.FRACAS |
| 152 | 165 |
| 153 def CreateAnalysis(self, crash_identifiers): | 166 def CreateAnalysis(self, crash_identifiers): |
| 154 # TODO: inline FracasCrashAnalysis.Create stuff here. | 167 # TODO: inline FracasCrashAnalysis.Create stuff here. |
| 155 return FracasCrashAnalysis.Create(crash_identifiers) | 168 return FracasCrashAnalysis.Create(crash_identifiers) |
| 156 | 169 |
| 157 def GetAnalysis(self, crash_identifiers): | 170 def GetAnalysis(self, crash_identifiers): |
| 158 # TODO: inline FracasCrashAnalysis.Get stuff here. | 171 # TODO: inline FracasCrashAnalysis.Get stuff here. |
| 159 return FracasCrashAnalysis.Get(crash_identifiers) | 172 return FracasCrashAnalysis.Get(crash_identifiers) |
| 173 |
| 174 def ProcessResultForPublishing(self, result, key): |
| 175 """Fracas specific processing of result data for publishing.""" |
| 176 result['feedback_url'] = _FRACAS_FEEDBACK_URL_TEMPLATE % ( |
| 177 appengine_util.GetDefaultVersionHostname(), key) |
| 178 return result |
| OLD | NEW |