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

Side by Side Diff: appengine/findit/model/base_analysis.py

Issue 2243673002: [Findit] Added algorithm to analysis (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: gclient sync Created 4 years, 4 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 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 8
9 9
10 class BaseAnalysis(ndb.Model): 10 class BaseAnalysis(ndb.Model):
11 """Represents a build analysis of a builder in a Chromium waterfall.""" 11 """Represents a build analysis of a builder in a Chromium waterfall."""
12 12
13 @property 13 @property
14 def completed(self): 14 def completed(self):
15 return self.status in ( 15 return self.status in (
16 analysis_status.COMPLETED, analysis_status.ERROR) 16 analysis_status.COMPLETED, analysis_status.ERROR)
17 17
18 @property 18 @property
19 def duration(self): 19 def duration(self):
20 if not self.completed or not self.end_time or not self.start_time: 20 if not self.completed or not self.end_time or not self.start_time:
21 return None 21 return None
22
22 return int((self.end_time - self.start_time).total_seconds()) 23 return int((self.end_time - self.start_time).total_seconds())
23 24
24 @property 25 @property
25 def failed(self): 26 def failed(self):
26 return self.status == analysis_status.ERROR 27 return self.status == analysis_status.ERROR
27 28
28 @property 29 @property
29 def status_description(self): 30 def status_description(self):
30 return analysis_status.STATUS_TO_DESCRIPTION.get(self.status, 'Unknown') 31 return analysis_status.STATUS_TO_DESCRIPTION.get(self.status, 'Unknown')
31 32
32 # The url path to the pipeline status page. 33 # The url path to the pipeline status page.
33 pipeline_status_path = ndb.StringProperty(indexed=False) 34 pipeline_status_path = ndb.StringProperty(indexed=False)
34 35
35 # The status of the analysis. 36 # The status of the analysis.
36 status = ndb.IntegerProperty(default=analysis_status.PENDING, indexed=False) 37 status = ndb.IntegerProperty(default=analysis_status.PENDING, indexed=False)
37 # When the analysis was requested. 38 # When the analysis was requested.
38 request_time = ndb.DateTimeProperty(indexed=False) 39 request_time = ndb.DateTimeProperty(indexed=False)
39 # When the analysis actually started. 40 # When the analysis actually started.
40 start_time = ndb.DateTimeProperty(indexed=False) 41 start_time = ndb.DateTimeProperty(indexed=False)
41 # When the analysis actually ended. 42 # When the analysis actually ended.
42 end_time = ndb.DateTimeProperty(indexed=False) 43 end_time = ndb.DateTimeProperty(indexed=False)
43 # When the analysis was updated. 44 # When the analysis was updated.
44 updated_time = ndb.DateTimeProperty(indexed=False, auto_now=True) 45 updated_time = ndb.DateTimeProperty(indexed=True, auto_now=True)
45 # Record which version of analysis. 46 # Record which version of analysis.
46 version = ndb.StringProperty(indexed=False) 47 version = ndb.StringProperty(indexed=False)
OLDNEW
« no previous file with comments | « appengine/findit/handlers/flake/test/check_flake_test.py ('k') | appengine/findit/model/flake/master_flake_analysis.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698