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

Unified Diff: appengine/findit/model/crash/fracas_crash_analysis.py

Issue 1946513003: [Findit] Modify the handler for fracas input message. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Address comment. Created 4 years, 7 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 side-by-side diff with in-line comments
Download patch
Index: appengine/findit/model/crash/fracas_crash_analysis.py
diff --git a/appengine/findit/model/crash/fracas_crash_analysis.py b/appengine/findit/model/crash/fracas_crash_analysis.py
index 8ace4ee376b5ed22bd71bdfa03b7be94b008fa54..bd31acc5ba9c3dfbf6ea0aa99d0b37527b035a4a 100644
--- a/appengine/findit/model/crash/fracas_crash_analysis.py
+++ b/appengine/findit/model/crash/fracas_crash_analysis.py
@@ -3,6 +3,7 @@
# found in the LICENSE file.
import hashlib
+import json
from google.appengine.ext import ndb
@@ -11,33 +12,26 @@ from model.crash.crash_analysis import CrashAnalysis
class FracasCrashAnalysis(CrashAnalysis):
"""Represents an analysis of a Chrome crash."""
- # Data of crash per million page loads for each Chrome version.
- versions_to_cpm = ndb.JsonProperty(indexed=False)
+ # Customized properties for Fracas crash.
+ historic_metadata = ndb.JsonProperty(indexed=False)
+ channel = ndb.StringProperty(indexed=False)
def Reset(self):
super(FracasCrashAnalysis, self).Reset()
- self.versions_to_cpm = None
-
- @ndb.ComputedProperty
- def channel(self):
- return self.key.pairs()[0][1].split('/')[0]
-
- @ndb.ComputedProperty
- def platform(self):
- return self.key.pairs()[0][1].split('/')[1]
+ self.historic_metadata = None
+ self.channel = None
@staticmethod
- def _CreateKey(channel, platform, signature):
+ def _CreateKey(crash_identifiers):
# Use sha1 hex digest of signature to avoid char conflict with '/'.
- return ndb.Key('FracasCrashAnalysis', '%s/%s/%s' % (
- channel, platform, hashlib.sha1(signature).hexdigest()))
+ return ndb.Key('FracasCrashAnalysis', hashlib.sha1(
+ json.dumps(crash_identifiers, sort_keys=True)).hexdigest())
@classmethod
- def Get(cls, channel, platform, signature):
- return cls._CreateKey(channel, platform, signature).get()
+ def Get(cls, crash_identifiers):
+ return cls._CreateKey(crash_identifiers).get()
@classmethod
- def Create(cls, channel, platform, signature):
- analysis = cls(key=cls._CreateKey(channel, platform, signature))
- analysis.signature = signature
+ def Create(cls, crash_identifiers):
+ analysis = cls(key=cls._CreateKey(crash_identifiers))
return analysis

Powered by Google App Engine
This is Rietveld 408576698