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

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

Issue 1852383002: [Findit] Integrate with Fracas through Pub/Sub. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Just rebase. Created 4 years, 8 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
« no previous file with comments | « appengine/findit/model/crash/crash_config.py ('k') | appengine/findit/model/crash/test/__init__.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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
new file mode 100644
index 0000000000000000000000000000000000000000..8ace4ee376b5ed22bd71bdfa03b7be94b008fa54
--- /dev/null
+++ b/appengine/findit/model/crash/fracas_crash_analysis.py
@@ -0,0 +1,43 @@
+# 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 hashlib
+
+from google.appengine.ext import ndb
+
+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)
+
+ 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]
+
+ @staticmethod
+ def _CreateKey(channel, platform, signature):
+ # Use sha1 hex digest of signature to avoid char conflict with '/'.
+ return ndb.Key('FracasCrashAnalysis', '%s/%s/%s' % (
+ channel, platform, hashlib.sha1(signature).hexdigest()))
+
+ @classmethod
+ def Get(cls, channel, platform, signature):
+ return cls._CreateKey(channel, platform, signature).get()
+
+ @classmethod
+ def Create(cls, channel, platform, signature):
+ analysis = cls(key=cls._CreateKey(channel, platform, signature))
+ analysis.signature = signature
+ return analysis
« no previous file with comments | « appengine/findit/model/crash/crash_config.py ('k') | appengine/findit/model/crash/test/__init__.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698