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

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

Issue 2657913002: [Predator] Add ``Project`` class and ``ClassifySuspect`` method to project and component classifier (Closed)
Patch Set: . Created 3 years, 11 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 from crash.culprit import Culprit 5 from crash.culprit import Culprit
6 6
7 # TODO(http://crbug.com/659346): write coverage tests. 7 # TODO(http://crbug.com/659346): write coverage tests.
8 class Predator(object): # pragma: no cover 8 class Predator(object): # pragma: no cover
9 """The Main entry point into the Predator library.""" 9 """The Main entry point into the Predator library."""
10 10
11 def __init__(self, cl_classifier, component_classifier, project_classifier): 11 def __init__(self, cl_classifier, component_classifier, project_classifier):
12 self.cl_classifier = cl_classifier 12 self.cl_classifier = cl_classifier
13 self.component_classifier = component_classifier 13 self.component_classifier = component_classifier
14 self.project_classifier = project_classifier 14 self.project_classifier = project_classifier
15 15
16 def FindCulprit(self, report): 16 def FindCulprit(self, report):
17 """Given a CrashReport, return a Culprit.""" 17 """Given a CrashReport, return a Culprit."""
18 suspected_cls = self.cl_classifier(report) 18 suspected_cls = self.cl_classifier(report)
19 assert suspected_cls is not None 19 assert suspected_cls is not None
20 20
21 suspected_project = self.project_classifier.Classify( 21 suspected_project = (
22 suspected_cls, report.stacktrace.crash_stack) 22 self.project_classifier.ClassifySuspects(suspected_cls) or
23 self.project_classifier.ClassifyCallStack(
24 report.stacktrace.crash_stack))
23 25
24 suspected_components = self.component_classifier.Classify( 26 suspected_components = (
25 suspected_cls, report.stacktrace.crash_stack) 27 self.component_classifier.ClassifySuspects(suspected_cls) or
28 self.component_classifier.ClassifyCallStack(
29 report.stacktrace.crash_stack))
26 30
27 return Culprit( 31 return Culprit(
28 project = suspected_project, 32 project = suspected_project,
29 components = suspected_components, 33 components = suspected_components,
30 cls = suspected_cls, 34 cls = suspected_cls,
31 regression_range = report.regression_range, 35 regression_range = report.regression_range,
32 algorithm = 'core_algorithm') 36 algorithm = 'core_algorithm')
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698