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