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

Side by Side 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 unified diff | Download patch
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 import hashlib
6
7 from google.appengine.ext import ndb
8
9 from model.crash.crash_analysis import CrashAnalysis
10
11
12 class FracasCrashAnalysis(CrashAnalysis):
13 """Represents an analysis of a Chrome crash."""
14 # Data of crash per million page loads for each Chrome version.
15 versions_to_cpm = ndb.JsonProperty(indexed=False)
16
17 def Reset(self):
18 super(FracasCrashAnalysis, self).Reset()
19 self.versions_to_cpm = None
20
21 @ndb.ComputedProperty
22 def channel(self):
23 return self.key.pairs()[0][1].split('/')[0]
24
25 @ndb.ComputedProperty
26 def platform(self):
27 return self.key.pairs()[0][1].split('/')[1]
28
29 @staticmethod
30 def _CreateKey(channel, platform, signature):
31 # Use sha1 hex digest of signature to avoid char conflict with '/'.
32 return ndb.Key('FracasCrashAnalysis', '%s/%s/%s' % (
33 channel, platform, hashlib.sha1(signature).hexdigest()))
34
35 @classmethod
36 def Get(cls, channel, platform, signature):
37 return cls._CreateKey(channel, platform, signature).get()
38
39 @classmethod
40 def Create(cls, channel, platform, signature):
41 analysis = cls(key=cls._CreateKey(channel, platform, signature))
42 analysis.signature = signature
43 return analysis
OLDNEW
« 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