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

Side by Side Diff: appengine/findit/model/crash/crash_analysis.py

Issue 2322133002: [Findit] Add cracas_crash_analysis (Closed)
Patch Set: Rebase. Created 4 years, 3 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
5 import hashlib
4 import json 6 import json
5 import logging 7 import logging
6 8
7 from google.appengine.ext import ndb 9 from google.appengine.ext import ndb
8 10
9 from model import analysis_status 11 from model import analysis_status
10 from model import triage_status 12 from model import triage_status
11 13
12 14
13 class CrashAnalysis(ndb.Model): 15 class CrashAnalysis(ndb.Model):
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 @property 128 @property
127 def failed(self): 129 def failed(self):
128 return self.status == analysis_status.ERROR 130 return self.status == analysis_status.ERROR
129 131
130 @property 132 @property
131 def duration(self): 133 def duration(self):
132 if not self.completed: 134 if not self.completed:
133 return None 135 return None
134 136
135 return int((self.completed_time - self.started_time).total_seconds()) 137 return int((self.completed_time - self.started_time).total_seconds())
138
139 @classmethod
140 def _CreateKey(cls, crash_identifiers):
141 return ndb.Key(cls.__name__, hashlib.sha1(
142 json.dumps(crash_identifiers, sort_keys=True)).hexdigest())
143
144 @classmethod
145 def Get(cls, crash_identifiers):
146 return cls._CreateKey(crash_identifiers).get()
147
148 @classmethod
149 def Create(cls, crash_identifiers):
150 return cls(key=cls._CreateKey(crash_identifiers))
OLDNEW
« no previous file with comments | « appengine/findit/model/crash/cracas_crash_analysis.py ('k') | appengine/findit/model/crash/fracas_crash_analysis.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698