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

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

Issue 2074273002: [Findit] Add feedback button for manual triage. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@show-result
Patch Set: Created 4 years, 5 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 import json
5 import logging
4 6
5 from google.appengine.ext import ndb 7 from google.appengine.ext import ndb
6 8
7 from model import analysis_status 9 from model import analysis_status
8 from model import triage_status 10 from model import triage_status
9 11
10 12
11 class CrashAnalysis(ndb.Model): 13 class CrashAnalysis(ndb.Model):
12 """Base class to represent an analysis of a Chrome/Clusterfuzz crash.""" 14 """Base class to represent an analysis of a Chrome/Clusterfuzz crash."""
13 ################### Properties for the crash itself. ################### 15 ################### Properties for the crash itself. ###################
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
65 regression_range_triage_status = ndb.IntegerProperty( 67 regression_range_triage_status = ndb.IntegerProperty(
66 indexed=True, default=triage_status.UNTRIAGED) 68 indexed=True, default=triage_status.UNTRIAGED)
67 culprit_regression_range = ndb.JsonProperty(indexed=False, default=[]) 69 culprit_regression_range = ndb.JsonProperty(indexed=False, default=[])
68 70
69 suspected_cls_triage_status = ndb.IntegerProperty( 71 suspected_cls_triage_status = ndb.IntegerProperty(
70 indexed=True, default=triage_status.UNTRIAGED) 72 indexed=True, default=triage_status.UNTRIAGED)
71 culprit_cls = ndb.JsonProperty(indexed=False, default=[]) 73 culprit_cls = ndb.JsonProperty(indexed=False, default=[])
72 74
73 suspected_project_triage_status = ndb.IntegerProperty( 75 suspected_project_triage_status = ndb.IntegerProperty(
74 indexed=True, default=triage_status.UNTRIAGED) 76 indexed=True, default=triage_status.UNTRIAGED)
75 culprit_project = ndb.JsonProperty(indexed=False, default='') 77 culprit_project = ndb.StringProperty(indexed=False, default='')
76 78
77 suspected_components_triage_status = ndb.IntegerProperty( 79 suspected_components_triage_status = ndb.IntegerProperty(
78 indexed=True, default=triage_status.UNTRIAGED) 80 indexed=True, default=triage_status.UNTRIAGED)
79 culprit_components = ndb.JsonProperty(indexed=False, default=[]) 81 culprit_components = ndb.JsonProperty(indexed=False, default=[])
80 82
81 triage_history = ndb.JsonProperty(indexed=False) 83 triage_history = ndb.JsonProperty(indexed=False, default=[])
stgao 2016/06/30 01:28:02 We'd better not "hard-code" [] as the default valu
Sharu Jiang 2016/07/01 22:05:48 Done.
82 84
83 # Triage note. 85 # Triage note.
84 note = ndb.StringProperty(indexed=False, default='') 86 note = ndb.StringProperty(indexed=False, default='')
85 87
86 def Reset(self): 88 def Reset(self):
87 self.pipeline_status_path = None 89 self.pipeline_status_path = None
88 self.status = analysis_status.PENDING 90 self.status = analysis_status.PENDING
89 self.requested_time = None 91 self.requested_time = None
90 self.started_time = None 92 self.started_time = None
91 self.completed_time = None 93 self.completed_time = None
92 self.findit_version = None 94 self.findit_version = None
93 self.has_regression_range = None 95 self.has_regression_range = None
94 self.found_suspects = None 96 self.found_suspects = None
95 self.solution = None 97 self.solution = None
96 self.result = {} 98 self.result = {}
97 self.regression_range_triage_status = triage_status.UNTRIAGED 99 self.regression_range_triage_status = triage_status.UNTRIAGED
98 self.culprit_regression_range = [] 100 self.culprit_regression_range = []
99 self.suspected_cls_triage_status = triage_status.UNTRIAGED 101 self.suspected_cls_triage_status = triage_status.UNTRIAGED
100 self.culprit_cls = [] 102 self.culprit_cls = []
101 self.suspected_project_triage_status = triage_status.UNTRIAGED 103 self.suspected_project_triage_status = triage_status.UNTRIAGED
102 self.culprit_project = '' 104 self.culprit_project = ''
103 self.suspected_components_triage_status = triage_status.UNTRIAGED 105 self.suspected_components_triage_status = triage_status.UNTRIAGED
104 self.culprit_components = [] 106 self.culprit_components = []
105 self.triage_history = None 107 self.triage_history = None
106 self.note = '' 108 self.note = ''
107 109
110 def Update(self, update):
111 try:
112 for key, value in update.iteritems():
113 if not hasattr(self, key):
114 continue
115
116 setattr(self, key, value)
117
118 return True
119 except Exception: # pragma: no cover.
stgao 2016/06/30 01:28:02 Why there will be exceptions here? What kinds of e
Sharu Jiang 2016/07/01 22:05:48 Just want to return False somehow, changed it to i
120 logging.warning('Failed to update %s' % json.dumps(update))
121 return False
122
108 @property 123 @property
109 def completed(self): 124 def completed(self):
110 return self.status in ( 125 return self.status in (
111 analysis_status.COMPLETED, analysis_status.ERROR) 126 analysis_status.COMPLETED, analysis_status.ERROR)
112 127
113 @property 128 @property
114 def failed(self): 129 def failed(self):
115 return self.status == analysis_status.ERROR 130 return self.status == analysis_status.ERROR
116 131
117 @property 132 @property
118 def duration(self): 133 def duration(self):
119 if not self.completed: 134 if not self.completed:
120 return None 135 return None
121 136
122 return int((self.completed_time - self.started_time).total_seconds()) 137 return int((self.completed_time - self.started_time).total_seconds())
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698