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

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: Rebase and fix tests. 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
« 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 30 matching lines...) Expand all
44 46
45 # When the analysis was completed. 47 # When the analysis was completed.
46 completed_time = ndb.DateTimeProperty(indexed=False) 48 completed_time = ndb.DateTimeProperty(indexed=False)
47 49
48 # Which version of findit produces this result. 50 # Which version of findit produces this result.
49 findit_version = ndb.StringProperty(indexed=False) 51 findit_version = ndb.StringProperty(indexed=False)
50 52
51 ################### Properties for the analysis result. ################### 53 ################### Properties for the analysis result. ###################
52 54
53 # Analysis results. 55 # Analysis results.
54 result = ndb.JsonProperty(compressed=True, indexed=False, default={}) 56 result = ndb.JsonProperty(compressed=True, indexed=False)
55 57
56 # Tags for query and monitoring. 58 # Tags for query and monitoring.
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.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)
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)
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)
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)
80 82
81 triage_history = ndb.JsonProperty(indexed=False) 83 triage_history = ndb.JsonProperty(indexed=False)
82 84
83 # Triage note. 85 # Triage note.
84 note = ndb.StringProperty(indexed=False, default='') 86 note = ndb.StringProperty(indexed=False)
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 = None
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 = None
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 = None
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 = None
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 = None
105 self.triage_history = None 107 self.triage_history = None
106 self.note = '' 108 self.note = None
109
110 def Update(self, update):
111 updated = False
112 for key, value in update.iteritems():
113 if not hasattr(self, key):
114 continue
115
116 setattr(self, key, value)
117 updated = True
118
119 return updated
107 120
108 @property 121 @property
109 def completed(self): 122 def completed(self):
110 return self.status in ( 123 return self.status in (
111 analysis_status.COMPLETED, analysis_status.ERROR) 124 analysis_status.COMPLETED, analysis_status.ERROR)
112 125
113 @property 126 @property
114 def failed(self): 127 def failed(self):
115 return self.status == analysis_status.ERROR 128 return self.status == analysis_status.ERROR
116 129
117 @property 130 @property
118 def duration(self): 131 def duration(self):
119 if not self.completed: 132 if not self.completed:
120 return None 133 return None
121 134
122 return int((self.completed_time - self.started_time).total_seconds()) 135 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