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

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

Issue 820113002: [Findit] Add a sub-pipeline to detect first-known failure. (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: Test will come in next patchset. Created 6 years 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 (c) 2014 The Chromium Authors. All rights reserved. 1 # Copyright (c) 2014 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 import calendar
6
7 from google.appengine.ext import ndb 5 from google.appengine.ext import ndb
8 6
9 from model.build_analysis_status import BuildAnalysisStatus
10
11 7
12 class Build(ndb.Model): 8 class Build(ndb.Model):
13 """Represent a build cycle of a builder in a waterfall.""" 9 """Represent a build cycle of a builder in a waterfall."""
14 10
15 @staticmethod 11 @staticmethod
16 def CreateKey(master_name, builder_name, build_number): # pragma: no cover 12 def CreateKey(master_name, builder_name, build_number): # pragma: no cover
17 return ndb.Key( 13 return ndb.Key(
18 'Master', master_name, 'Builder', builder_name, 'Build', build_number) 14 'Master', master_name, 'Builder', builder_name, 'Build', build_number)
19 15
20 @staticmethod 16 @staticmethod
21 def CreateBuild(master_name, builder_name, build_number): # pragma: no cover 17 def CreateBuild(master_name, builder_name, build_number): # pragma: no cover
22 """Create a Build instance, but not save it to datastore.""" 18 """Create a Build instance, but not save it to datastore."""
qyearsley 2014/12/29 19:44:53 1. In general, the verb for a docstring is in thir
stgao 2015/01/03 01:31:46 Good catch!
23 return Build(key=Build.CreateKey(master_name, builder_name, build_number), 19 return Build(key=Build.CreateKey(master_name, builder_name, build_number),
24 master_name=master_name, 20 master_name=master_name,
25 builder_name=builder_name, 21 builder_name=builder_name,
26 build_number=build_number) 22 build_number=build_number)
27 23
28 @staticmethod 24 @staticmethod
29 def GetBuild(master_name, builder_name, build_number): # pragma: no cover 25 def GetBuild(master_name, builder_name, build_number): # pragma: no cover
30 return Build.CreateKey(master_name, builder_name, build_number).get() 26 return Build.CreateKey(master_name, builder_name, build_number).get()
31 27
32 def Reset(self):
33 """Reset to the state as if no analysis is run."""
34 self.analysis_status = BuildAnalysisStatus.PENDING
35 self.analysis_start_time = None
36 self.analysis_updated_time = None
37
38 # Information of the build.
39 master_name = ndb.StringProperty(indexed=False) 28 master_name = ndb.StringProperty(indexed=False)
40 builder_name = ndb.StringProperty(indexed=False) 29 builder_name = ndb.StringProperty(indexed=False)
41 build_number = ndb.IntegerProperty(indexed=False) 30 build_number = ndb.IntegerProperty(indexed=False)
42 31
43 # Information of analysis processing. 32 data = ndb.JsonProperty(indexed=False, compressed=True)
44 analysis_status = ndb.IntegerProperty( 33 last_crawled_time = ndb.DateTimeProperty(indexed=False)
45 default=BuildAnalysisStatus.PENDING, indexed=False) 34
46 analysis_start_time = ndb.DateTimeProperty(indexed=False) 35 start_time = ndb.DateTimeProperty(indexed=False)
47 analysis_updated_time = ndb.DateTimeProperty(indexed=False) 36 completed = ndb.BooleanProperty(default=False, indexed=False)
37 result = ndb.IntegerProperty(indexed=False)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698