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

Side by Side Diff: appengine/findit/model/flake/flake_swarming_task.py

Issue 2124973003: These are the database objects used while finding the regression range. 1/3 (Closed) Base URL: https://chromium.googlesource.com/infra/infra.git@master
Patch Set: addressed jeff's comments 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
OLDNEW
(Empty)
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
3 # found in the LICENSE file.
4
5 from google.appengine.ext import ndb
6
7 from common import constants
8 from model import analysis_status
9 from model.base_swarming_task import BaseSwarmingTask
10 from model.base_build_model import BaseBuildModel
11
12 class FlakeSwarmingTask(BaseSwarmingTask, BaseBuildModel):
13 """Represents a swarming task for a step w/candidate flaky tests.
14 """
lijeffrey 2016/07/22 00:23:38 nit: closing """ fits on previous line
15
16 @staticmethod
17 def CreateSwarmingTaskId(
18 master_name, builder_name, build_number,
19 step_name, test_name): # pragma: no cover
20 return '%s/%s/%s/%s/%s' % (master_name, builder_name,
21 build_number, step_name, test_name)
22
23 @staticmethod
24 def _CreateKey(
25 master_name, builder_name, build_number,
26 step_name, test_name): # pragma: no cover
27 return ndb.Key('FlakeSwarmingTask',
28 FlakeSwarmingTask.CreateSwarmingTaskId(
29 master_name, builder_name, build_number,
30 step_name, test_name))
31
32 @staticmethod
33 def Create(
34 master_name, builder_name, build_number,
35 step_name, test_name): # pragma: no cover
36 return FlakeSwarmingTask(key=FlakeSwarmingTask._CreateKey(
37 master_name, builder_name, build_number, step_name, test_name))
38
39 @ndb.ComputedProperty
40 def step_name(self):
41 return self.key.pairs()[0][1].split('/')[3]
42
43 @ndb.ComputedProperty
44 def test_name(self):
45 return self.key.pairs()[0][1].split('/')[4]
46
47
lijeffrey 2016/07/22 00:23:38 nit: remove extra empty line before @staticmethod.
48 @staticmethod
49 def Get(
50 master_name, builder_name, build_number,
51 step_name, test_name): # pragma: no cover
52 return FlakeSwarmingTask._CreateKey(
53 master_name, builder_name, build_number, step_name, test_name).get(
lijeffrey 2016/07/22 00:23:38 line too long. find a way to put .get() in the sam
54 )
55 # Number of runs the test passed.
56 successes = ndb.IntegerProperty(default=0, indexed=False)
57 # How many times the test was rerun.
58 tries = ndb.IntegerProperty(default=0, indexed=False)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698