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

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

Issue 2067373002: [Findit] Add fracas analysis result feedback page for manual triage. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@only-dashboard
Patch Set: Merge branch 'only-dashboard' into dashboard Created 4 years, 6 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
« no previous file with comments | « appengine/findit/main.py ('k') | appengine/findit/model/crash/test/crash_analysis_test.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
57 has_regression_range = ndb.BooleanProperty(indexed=True) 59 has_regression_range = ndb.BooleanProperty(indexed=True)
58 found_suspects = ndb.BooleanProperty(indexed=True) 60 found_suspects = ndb.BooleanProperty(indexed=True)
59 found_project = ndb.BooleanProperty(indexed=True) 61 found_project = ndb.BooleanProperty(indexed=True)
60 found_components = ndb.BooleanProperty(indexed=True) 62 found_components = ndb.BooleanProperty(indexed=True)
61 63
62 solution = ndb.StringProperty(indexed=True) # 'core', 'blame', etc. 64 solution = ndb.StringProperty(indexed=True) # 'core', 'blame', etc.
63 65
64 # Triage results. 66 # Triage results.
65 regression_range_triage_status = ndb.StringProperty( 67 regression_range_triage_status = ndb.StringProperty(
66 indexed=True, default=triage_status.UNTRIAGED) 68 indexed=True, default=triage_status.UNTRIAGED)
67 culprit_regression_range = ndb.JsonProperty(indexed=False) 69 culprit_regression_range = ndb.JsonProperty(indexed=False, default=[])
68 70
69 suspected_cls_triage_status = ndb.StringProperty( 71 suspected_cls_triage_status = ndb.StringProperty(
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.StringProperty( 75 suspected_project_triage_status = ndb.StringProperty(
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.StringProperty( 79 suspected_components_triage_status = ndb.StringProperty(
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=[])
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 ResultCorrect(self, result_property):
87 """Returns triage result of a result property.
88
89 True if the result is triaged-correct, False if triaged-incorrect, else
90 return None.
91 """
92 if not self.completed or self.failed:
93 return None
94
95 result_triage_status = getattr(self, '%s_triage_status' % result_property)
96 if result_triage_status == triage_status.TRIAGED_CORRECT:
97 return True
98
99 if result_triage_status == triage_status.TRIAGED_INCORRECT:
100 return False
101
102 return None
103
104 def Reset(self): 88 def Reset(self):
105 self.pipeline_status_path = None 89 self.pipeline_status_path = None
106 self.status = analysis_status.PENDING 90 self.status = analysis_status.PENDING
107 self.requested_time = None 91 self.requested_time = None
108 self.started_time = None 92 self.started_time = None
109 self.completed_time = None 93 self.completed_time = None
110 self.findit_version = None 94 self.findit_version = None
111 self.has_regression_range = None 95 self.has_regression_range = None
112 self.found_suspects = None 96 self.found_suspects = None
113 self.solution = None 97 self.solution = None
114 98
99 def Update(self, update):
100 try:
101 for key, value in update.iteritems():
102 setattr(self, key, value)
103
104 return True
105 except Exception: # pragma: no cover.
106 logging.warning('Failed to update %s' % json.dumps(update))
107 return False
108
115 @property 109 @property
116 def completed(self): 110 def completed(self):
117 return self.status in ( 111 return self.status in (
118 analysis_status.COMPLETED, analysis_status.ERROR) 112 analysis_status.COMPLETED, analysis_status.ERROR)
119 113
120 @property 114 @property
121 def failed(self): 115 def failed(self):
122 return self.status == analysis_status.ERROR 116 return self.status == analysis_status.ERROR
123 117
124 @property 118 @property
125 def duration(self): 119 def duration(self):
126 if not self.completed: 120 if not self.completed:
127 return None 121 return None
128 122
129 return int((self.completed_time - self.started_time).total_seconds()) 123 return int((self.completed_time - self.started_time).total_seconds())
OLDNEW
« no previous file with comments | « appengine/findit/main.py ('k') | appengine/findit/model/crash/test/crash_analysis_test.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698