Chromium Code Reviews| Index: appengine/findit/crash/crash_report.py |
| diff --git a/appengine/findit/crash/crash_report.py b/appengine/findit/crash/crash_report.py |
| new file mode 100644 |
| index 0000000000000000000000000000000000000000..93bf42ea3df3baa95fa204ad6445d01bf097db46 |
| --- /dev/null |
| +++ b/appengine/findit/crash/crash_report.py |
| @@ -0,0 +1,42 @@ |
| +# Copyright 2016 The Chromium Authors. All rights reserved. |
| +# Use of this source code is governed by a BSD-style license that can be |
| +# found in the LICENSE file. |
| + |
| +import logging |
| +from collections import namedtuple |
| + |
| +from crash.stacktrace import Stacktrace |
| + |
| +# TODO(katesonia): the CrashAnalysis(ndb.Model) is how we store these |
| +# objects in the application. However, note that these aren't actually |
| +# "analyses"; they're the *input* to our analysis, whereas Culprit |
|
Sharu Jiang
2016/10/12 17:46:29
The CrashAnalysis contains *input* and *output* of
wrengr
2016/10/12 21:14:51
Acknowledged.
|
| +# is the output from analysis. So the ndb.Model and assorted other things |
| +# should be renamed appropriately. However, in general we don't yet have |
| +# a standard for distinguishing the namedtuples used internally by azalea |
| +# vs the ndb.Models for storing those namedtuples in the appengine |
| +# application; so we'll want to come up with a naming scheme for that. |
| +class CrashReport(namedtuple('CrashReport', |
| + ['crashed_version', 'signature', 'platform', 'stacktrace', |
| + 'regression_range'])): |
| + """A reported crash we want to analyze. |
| + |
| + Args: |
| + crashed_version (str): The version of Chrome in which the crash occurred. |
| + signature (str): The signature of the crash on the Chrome crash server. |
| + platform (str): The platform name; e.g., 'win', 'mac', 'linux', 'android', |
| + 'ios', etc. |
| + stacktrace (Stacktrace): The stacktrace of the crash. N.B., this is |
| + an object generated by parsing the string containing the stack trace; |
| + we do not store the string itself. |
| + regression_range : a pair of the last-good and first-bad versions. |
| + """ |
| + __slots__ = () |
| + |
| + def __new__(cls, crashed_version, signature, platform, stacktrace, regression_range): |
| + if not isinstance(stacktrace, Stacktrace): |
| + raise TypeError('In the fourth argument to CrashReport constructor, ' |
| + 'expected Stacktrace object, but got %s object instead.' % |
| + stacktrace.__class__.__name__) |
| + |
| + return super(cls, CrashReport).__new__(cls, |
| + crashed_version, signature, platform, stacktrace, regression_range) |