| 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 crash.clusterfuzz_data import ClusterfuzzData | 9 from crash.clusterfuzz_data import ClusterfuzzData |
| 10 from crash.clusterfuzz_parser import ClusterfuzzParser | 10 from crash.clusterfuzz_parser import ClusterfuzzParser |
| 11 from crash.findit import Findit | 11 from crash.findit import Findit |
| 12 from crash.loglinear.changelist_classifier import LogLinearChangelistClassifier | 12 from crash.loglinear.changelist_classifier import LogLinearChangelistClassifier |
| 13 from crash.loglinear.changelist_features.touch_crashed_directory import ( |
| 14 TouchCrashedDirectoryFeature) |
| 13 from crash.loglinear.changelist_features.touch_crashed_file_meta import ( | 15 from crash.loglinear.changelist_features.touch_crashed_file_meta import ( |
| 14 TouchCrashedFileMetaFeature) | 16 TouchCrashedFileMetaFeature) |
| 15 from crash.loglinear.feature import WrapperMetaFeature | 17 from crash.loglinear.feature import WrapperMetaFeature |
| 16 from crash.loglinear.weight import MetaWeight | 18 from crash.loglinear.weight import MetaWeight |
| 17 from crash.loglinear.weight import Weight | 19 from crash.loglinear.weight import Weight |
| 18 from crash.predator import Predator | 20 from crash.predator import Predator |
| 19 from crash.type_enums import CrashClient | 21 from crash.type_enums import CrashClient |
| 20 from model.crash.clusterfuzz_analysis import ClusterfuzzAnalysis | 22 from model.crash.clusterfuzz_analysis import ClusterfuzzAnalysis |
| 21 | 23 |
| 22 | 24 |
| 23 class FinditForClusterfuzz(Findit): | 25 class FinditForClusterfuzz(Findit): |
| 24 @classmethod | 26 @classmethod |
| 25 def _ClientID(cls): | 27 def _ClientID(cls): |
| 26 return CrashClient.CLUSTERFUZZ | 28 return CrashClient.CLUSTERFUZZ |
| 27 | 29 |
| 28 def __init__(self, get_repository, config): | 30 def __init__(self, get_repository, config): |
| 29 super(FinditForClusterfuzz, self).__init__(get_repository, config) | 31 super(FinditForClusterfuzz, self).__init__(get_repository, config) |
| 30 meta_weight = MetaWeight({ | 32 meta_weight = MetaWeight({ |
| 31 'TouchCrashedFileMeta': MetaWeight({ | 33 'TouchCrashedFileMeta': MetaWeight({ |
| 32 'MinDistance': Weight(1.), | 34 'MinDistance': Weight(1.), |
| 33 'TopFrameIndex': Weight(1.), | 35 'TopFrameIndex': Weight(1.), |
| 34 'TouchCrashedFile': Weight(1.), | 36 'TouchCrashedFile': Weight(1.), |
| 35 }) | 37 }), |
| 38 'TouchCrashedDirectory': Weight(1.) |
| 36 }) | 39 }) |
| 37 meta_feature = WrapperMetaFeature( | 40 meta_feature = WrapperMetaFeature( |
| 38 [TouchCrashedFileMetaFeature(get_repository)]) | 41 [TouchCrashedFileMetaFeature(get_repository), |
| 42 TouchCrashedDirectoryFeature()]) |
| 39 | 43 |
| 40 self._predator = Predator(LogLinearChangelistClassifier(get_repository, | 44 self._predator = Predator(LogLinearChangelistClassifier(get_repository, |
| 41 meta_feature, | 45 meta_feature, |
| 42 meta_weight), | 46 meta_weight), |
| 43 self._component_classifier, | 47 self._component_classifier, |
| 44 self._project_classifier) | 48 self._project_classifier) |
| 45 | 49 |
| 46 def _Predator(self): # pragma: no cover | 50 def _Predator(self): # pragma: no cover |
| 47 return self._predator | 51 return self._predator |
| 48 | 52 |
| 49 def CreateAnalysis(self, crash_identifiers): | 53 def CreateAnalysis(self, crash_identifiers): |
| 50 """Creates ``ClusterfuzzAnalysis`` with crash_identifiers as key.""" | 54 """Creates ``ClusterfuzzAnalysis`` with crash_identifiers as key.""" |
| 51 return ClusterfuzzAnalysis.Create(crash_identifiers) | 55 return ClusterfuzzAnalysis.Create(crash_identifiers) |
| 52 | 56 |
| 53 def GetAnalysis(self, crash_identifiers): | 57 def GetAnalysis(self, crash_identifiers): |
| 54 """Gets ``ClusterfuzzAnalysis`` using crash_identifiers.""" | 58 """Gets ``ClusterfuzzAnalysis`` using crash_identifiers.""" |
| 55 return ClusterfuzzAnalysis.Get(crash_identifiers) | 59 return ClusterfuzzAnalysis.Get(crash_identifiers) |
| 56 | 60 |
| 57 def GetCrashData(self, raw_crash_data): | 61 def GetCrashData(self, raw_crash_data): |
| 58 """Gets ``ClusterfuzzData`` from ``raw_crash_data``.""" | 62 """Gets ``ClusterfuzzData`` from ``raw_crash_data``.""" |
| 59 return ClusterfuzzData(raw_crash_data) | 63 return ClusterfuzzData(raw_crash_data) |
| 60 | 64 |
| 61 def ProcessResultForPublishing(self, result, key): # pylint: disable=W0613 | 65 def ProcessResultForPublishing(self, result, key): # pylint: disable=W0613 |
| 62 """Clusterfuzz specific processing of result data for publishing.""" | 66 """Clusterfuzz specific processing of result data for publishing.""" |
| 63 # TODO(katesonia) Add feedback page link information to result after | 67 # TODO(katesonia) Add feedback page link information to result after |
| 64 # feedback page of Clusterfuzz is added. | 68 # feedback page of Clusterfuzz is added. |
| 65 return result # pragma: no cover | 69 return result # pragma: no cover |
| OLD | NEW |