| OLD | NEW |
| 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 | 4 |
| 5 from google.appengine.ext import ndb | 5 from google.appengine.ext import ndb |
| 6 | 6 |
| 7 from model import analysis_status | 7 from model import analysis_status |
| 8 from model import triage_status |
| 8 | 9 |
| 9 | 10 |
| 10 class CrashAnalysis(ndb.Model): | 11 class CrashAnalysis(ndb.Model): |
| 11 """Base class to represent an analysis of a Chrome/Clusterfuzz crash.""" | 12 """Base class to represent an analysis of a Chrome/Clusterfuzz crash.""" |
| 12 ################### Properties for the crash itself. ################### | 13 ################### Properties for the crash itself. ################### |
| 13 # In which version or revision of Chrome the crash occurred. Either a version | 14 # 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 # number for Chrome build or a git commit hash/position for chromium build. |
| 15 crashed_version = ndb.StringProperty(indexed=False) | 16 crashed_version = ndb.StringProperty(indexed=False) |
| 16 | 17 |
| 17 # The stack_trace_string. | 18 # The stack_trace_string. |
| (...skipping 25 matching lines...) Expand all Loading... |
| 43 | 44 |
| 44 # When the analysis was completed. | 45 # When the analysis was completed. |
| 45 completed_time = ndb.DateTimeProperty(indexed=False) | 46 completed_time = ndb.DateTimeProperty(indexed=False) |
| 46 | 47 |
| 47 # Which version of findit produces this result. | 48 # Which version of findit produces this result. |
| 48 findit_version = ndb.StringProperty(indexed=False) | 49 findit_version = ndb.StringProperty(indexed=False) |
| 49 | 50 |
| 50 ################### Properties for the analysis result. ################### | 51 ################### Properties for the analysis result. ################### |
| 51 | 52 |
| 52 # Analysis results. | 53 # Analysis results. |
| 53 result = ndb.JsonProperty(compressed=True, indexed=False) | 54 result = ndb.JsonProperty(compressed=True, indexed=False, default={}) |
| 54 | 55 |
| 55 # Tags for query and monitoring. | 56 # Tags for query and monitoring. |
| 56 has_regression_range = ndb.BooleanProperty(indexed=True) | 57 has_regression_range = ndb.BooleanProperty(indexed=True) |
| 57 found_suspects = ndb.BooleanProperty(indexed=True) | 58 found_suspects = ndb.BooleanProperty(indexed=True) |
| 59 found_project = ndb.BooleanProperty(indexed=True) |
| 60 found_components = ndb.BooleanProperty(indexed=True) |
| 61 |
| 58 solution = ndb.StringProperty(indexed=True) # 'core', 'blame', etc. | 62 solution = ndb.StringProperty(indexed=True) # 'core', 'blame', etc. |
| 59 | 63 |
| 64 # Triage results. |
| 65 regression_range_triage_status = ndb.IntegerProperty( |
| 66 indexed=True, default=triage_status.UNTRIAGED) |
| 67 culprit_regression_range = ndb.JsonProperty(indexed=False, default=[]) |
| 68 |
| 69 suspected_cls_triage_status = ndb.IntegerProperty( |
| 70 indexed=True, default=triage_status.UNTRIAGED) |
| 71 culprit_cls = ndb.JsonProperty(indexed=False, default=[]) |
| 72 |
| 73 suspected_project_triage_status = ndb.IntegerProperty( |
| 74 indexed=True, default=triage_status.UNTRIAGED) |
| 75 culprit_project = ndb.JsonProperty(indexed=False, default='') |
| 76 |
| 77 suspected_components_triage_status = ndb.IntegerProperty( |
| 78 indexed=True, default=triage_status.UNTRIAGED) |
| 79 culprit_components = ndb.JsonProperty(indexed=False, default=[]) |
| 80 |
| 81 triage_history = ndb.JsonProperty(indexed=False) |
| 82 |
| 83 # Triage note. |
| 84 note = ndb.StringProperty(indexed=False, default='') |
| 85 |
| 60 def Reset(self): | 86 def Reset(self): |
| 61 self.pipeline_status_path = None | 87 self.pipeline_status_path = None |
| 62 self.status = analysis_status.PENDING | 88 self.status = analysis_status.PENDING |
| 63 self.requested_time = None | 89 self.requested_time = None |
| 64 self.started_time = None | 90 self.started_time = None |
| 65 self.completed_time = None | 91 self.completed_time = None |
| 66 self.findit_version = None | 92 self.findit_version = None |
| 67 self.has_regression_range = None | 93 self.has_regression_range = None |
| 68 self.found_suspects = None | 94 self.found_suspects = None |
| 69 self.solution = None | 95 self.solution = None |
| 96 self.result = {} |
| 97 self.regression_range_triage_status = triage_status.UNTRIAGED |
| 98 self.culprit_regression_range = [] |
| 99 self.suspected_cls_triage_status = triage_status.UNTRIAGED |
| 100 self.culprit_cls = [] |
| 101 self.suspected_project_triage_status = triage_status.UNTRIAGED |
| 102 self.culprit_project = '' |
| 103 self.suspected_components_triage_status = triage_status.UNTRIAGED |
| 104 self.culprit_components = [] |
| 105 self.triage_history = None |
| 106 self.note = '' |
| 70 | 107 |
| 71 @property | 108 @property |
| 72 def completed(self): | 109 def completed(self): |
| 73 return self.status in ( | 110 return self.status in ( |
| 74 analysis_status.COMPLETED, analysis_status.ERROR) | 111 analysis_status.COMPLETED, analysis_status.ERROR) |
| 75 | 112 |
| 76 @property | 113 @property |
| 77 def failed(self): | 114 def failed(self): |
| 78 return self.status == analysis_status.ERROR | 115 return self.status == analysis_status.ERROR |
| 79 | 116 |
| 80 @property | 117 @property |
| 81 def duration(self): | 118 def duration(self): |
| 82 if not self.completed: | 119 if not self.completed: |
| 83 return None | 120 return None |
| 84 | 121 |
| 85 return int((self.completed_time - self.started_time).total_seconds()) | 122 return int((self.completed_time - self.started_time).total_seconds()) |
| OLD | NEW |