| OLD | NEW |
| (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 from google.appengine.ext import ndb |
| 6 |
| 7 from model import analysis_status |
| 8 |
| 9 |
| 10 class CrashAnalysis(ndb.Model): |
| 11 """Base class to represent an analysis of a Chrome crash.""" |
| 12 # In which version or revision of Chrome the crash occurred. Either a version |
| 13 # number for Chrome build or a git commit hash/position for chromium build. |
| 14 crashed_version = ndb.StringProperty(indexed=False) |
| 15 # The stack_trace_string. |
| 16 stack_trace = ndb.StringProperty(indexed=False) |
| 17 # The signature of the crash. |
| 18 signature = ndb.StringProperty(indexed=False) |
| 19 |
| 20 # The url path to the pipeline status page. |
| 21 pipeline_status_path = ndb.StringProperty(indexed=False) |
| 22 # The status of the analysis. |
| 23 status = ndb.IntegerProperty( |
| 24 default=analysis_status.PENDING, indexed=False) |
| 25 # When the analysis was requested. |
| 26 requested_time = ndb.DateTimeProperty(indexed=True) |
| 27 # When the analysis was started. |
| 28 started_time = ndb.DateTimeProperty(indexed=False) |
| 29 # When the analysis was completed. |
| 30 completed_time = ndb.DateTimeProperty(indexed=False) |
| 31 # Which version of findit produces this result. |
| 32 findit_version = ndb.StringProperty(indexed=False) |
| 33 |
| 34 # Analysis results. |
| 35 result = ndb.JsonProperty(compressed=True, indexed=False) |
| 36 |
| 37 # Tags for query and monitoring. |
| 38 has_regression_range = ndb.BooleanProperty(indexed=True) |
| 39 found_suspects = ndb.BooleanProperty(indexed=True) |
| 40 solution = ndb.StringProperty(indexed=True) # 'core', 'blame', etc. |
| 41 |
| 42 def Reset(self): |
| 43 self.pipeline_status_path = None |
| 44 self.status = analysis_status.PENDING |
| 45 self.requested_time = None |
| 46 self.started_time = None |
| 47 self.completed_time = None |
| 48 self.findit_version = None |
| 49 self.has_regression_range = None |
| 50 self.found_suspects = None |
| 51 self.solution = None |
| 52 |
| 53 @property |
| 54 def completed(self): |
| 55 return self.status in ( |
| 56 analysis_status.COMPLETED, analysis_status.ERROR) |
| 57 |
| 58 @property |
| 59 def failed(self): |
| 60 return self.status == analysis_status.ERROR |
| 61 |
| 62 @property |
| 63 def duration(self): |
| 64 if not self.completed: |
| 65 return None |
| 66 |
| 67 return int((self.completed_time - self.started_time).total_seconds()) |
| OLD | NEW |