Chromium Code Reviews| 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. |
| 16 crash_identifiers = ndb.JsonProperty(indexed=False, compressed=True) | |
| 17 | |
| 15 crashed_version = ndb.StringProperty(indexed=False) | 18 crashed_version = ndb.StringProperty(indexed=False) |
| 16 | 19 |
| 17 # The stack_trace_string. | 20 # The stack_trace_string. |
| 18 stack_trace = ndb.StringProperty(indexed=False) | 21 stack_trace = ndb.StringProperty(indexed=False) |
| 19 | 22 |
| 20 # The signature of the crash. | 23 # The signature of the crash. |
| 21 signature = ndb.StringProperty(indexed=False) | 24 signature = ndb.StringProperty(indexed=False) |
| 22 | 25 |
| 23 # The platform of this crash. | 26 # The platform of this crash. |
| 24 platform = ndb.StringProperty(indexed=False) | 27 platform = ndb.StringProperty(indexed=False) |
| (...skipping 23 matching lines...) Expand all Loading... | |
| 48 findit_version = ndb.StringProperty(indexed=False) | 51 findit_version = ndb.StringProperty(indexed=False) |
| 49 | 52 |
| 50 ################### Properties for the analysis result. ################### | 53 ################### Properties for the analysis result. ################### |
| 51 | 54 |
| 52 # Analysis results. | 55 # Analysis results. |
| 53 result = ndb.JsonProperty(compressed=True, indexed=False) | 56 result = ndb.JsonProperty(compressed=True, indexed=False) |
| 54 | 57 |
| 55 # Tags for query and monitoring. | 58 # Tags for query and monitoring. |
| 56 has_regression_range = ndb.BooleanProperty(indexed=True) | 59 has_regression_range = ndb.BooleanProperty(indexed=True) |
| 57 found_suspects = ndb.BooleanProperty(indexed=True) | 60 found_suspects = ndb.BooleanProperty(indexed=True) |
| 61 found_project = ndb.BooleanProperty(indexed=True) | |
| 62 found_components = ndb.BooleanProperty(indexed=True) | |
| 63 | |
| 58 solution = ndb.StringProperty(indexed=True) # 'core', 'blame', etc. | 64 solution = ndb.StringProperty(indexed=True) # 'core', 'blame', etc. |
| 59 | 65 |
| 66 # Triage results. | |
| 67 regression_range_triage_status = ndb.StringProperty( | |
| 68 indexed=True, default=triage_status.UNTRIAGED) | |
| 69 regression_range_triage_history = ndb.JsonProperty(indexed=False) | |
| 70 culprit_regression_range = ndb.JsonProperty(indexed=False) | |
| 71 | |
| 72 suspected_cls_triage_status = ndb.StringProperty( | |
| 73 indexed=True, default=triage_status.UNTRIAGED) | |
| 74 suspected_cls_triage_history = ndb.JsonProperty(indexed=False) | |
| 75 culprit_cls = ndb.JsonProperty(indexed=False, default=[]) | |
| 76 | |
| 77 suspected_project_triage_status = ndb.StringProperty( | |
| 78 indexed=True, default=triage_status.UNTRIAGED) | |
| 79 suspected_project_triage_history = ndb.JsonProperty(indexed=False) | |
| 80 culprit_project = ndb.JsonProperty(indexed=False, default=[]) | |
| 81 | |
| 82 suspected_components_triage_status = ndb.StringProperty( | |
| 83 indexed=True, default=triage_status.UNTRIAGED) | |
| 84 suspected_components_triage_history = ndb.JsonProperty(indexed=False) | |
|
stgao
2016/06/08 17:53:45
Why we save the triage history separately? Can we
Sharu Jiang
2016/06/09 06:13:28
Done.
| |
| 85 culprit_components = ndb.JsonProperty(indexed=False, default=[]) | |
| 86 | |
| 87 # Triage note. | |
| 88 note = ndb.StringProperty(indexed=False, default='') | |
| 89 | |
| 90 def ResultCorrect(self, result_property): | |
| 91 """Returns triage result of a result property. | |
| 92 | |
| 93 True if the result is triaged-correct, False if triaged-incorrect, else | |
| 94 return None. | |
| 95 """ | |
| 96 if not self.completed or self.failed: | |
| 97 return None | |
| 98 | |
| 99 result_triage_status = getattr(self, '%s_triage_status' % result_property) | |
| 100 if result_triage_status == triage_status.TRIAGED_CORRECT: | |
| 101 return True | |
| 102 | |
| 103 if result_triage_status == triage_status.TRIAGED_INCORRECT: | |
| 104 return False | |
| 105 | |
| 106 return None | |
| 107 | |
| 60 def Reset(self): | 108 def Reset(self): |
| 61 self.pipeline_status_path = None | 109 self.pipeline_status_path = None |
| 62 self.status = analysis_status.PENDING | 110 self.status = analysis_status.PENDING |
| 63 self.requested_time = None | 111 self.requested_time = None |
| 64 self.started_time = None | 112 self.started_time = None |
| 65 self.completed_time = None | 113 self.completed_time = None |
| 66 self.findit_version = None | 114 self.findit_version = None |
| 67 self.has_regression_range = None | 115 self.has_regression_range = None |
| 68 self.found_suspects = None | 116 self.found_suspects = None |
| 69 self.solution = None | 117 self.solution = None |
| 70 | 118 |
| 71 @property | 119 @property |
| 72 def completed(self): | 120 def completed(self): |
| 73 return self.status in ( | 121 return self.status in ( |
| 74 analysis_status.COMPLETED, analysis_status.ERROR) | 122 analysis_status.COMPLETED, analysis_status.ERROR) |
| 75 | 123 |
| 76 @property | 124 @property |
| 77 def failed(self): | 125 def failed(self): |
| 78 return self.status == analysis_status.ERROR | 126 return self.status == analysis_status.ERROR |
| 79 | 127 |
| 80 @property | 128 @property |
| 81 def duration(self): | 129 def duration(self): |
| 82 if not self.completed: | 130 if not self.completed: |
| 83 return None | 131 return None |
| 84 | 132 |
| 85 return int((self.completed_time - self.started_time).total_seconds()) | 133 return int((self.completed_time - self.started_time).total_seconds()) |
| OLD | NEW |