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

Side by Side Diff: appengine/findit/model/base_build_model.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: Address comments Created 5 years, 11 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/app.yaml ('k') | appengine/findit/model/build.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
(Empty)
1 # Copyright 2014 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5 from google.appengine.ext import ndb
6
7
8 class BaseBuildModel(ndb.Model): # pragma: no cover
9 """A base class to provide computed properties from the key.
10
11 The computed properties are master name, builder name, and build number.
12 Subclasses should set its key as:
13 build_id = BaseBuildModel.CreateBuildId(
14 master_name, builder_name, build_number)
15 ndb.Key('KindName', build_id, 'Optional_KindName', optional_id, ...)
16 """
17
18 @staticmethod
19 def CreateBuildId(master_name, builder_name, build_number):
20 return '%s/%s/%s' % (master_name, builder_name, build_number)
21
22 @ndb.ComputedProperty
23 def master_name(self):
24 return self.key.pairs()[0][1].split('/')[0]
25
26 @ndb.ComputedProperty
27 def builder_name(self):
28 return self.key.pairs()[0][1].split('/')[1]
29
30 @ndb.ComputedProperty
31 def build_number(self):
32 return int(self.key.pairs()[0][1].split('/')[2])
OLDNEW
« no previous file with comments | « appengine/findit/app.yaml ('k') | appengine/findit/model/build.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698