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

Side by Side Diff: appengine/findit/model/flake/master_flake_analysis.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: 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 2014 The Chromium Authors. All rights reserved.
chanli 2016/07/07 23:38:28 2014 -> 2016
caiw 2016/07/14 00:59:40 Done.
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.flake.base_analysis import BaseAnalysis
10 from model.flake.flake_swarming_task import FlakeSwarmingTask
11
12 class MasterFlakeAnalysis(BaseAnalysis):
13 """Represents an analysis of a candidate flaky test in a Chromium Waterfall.
14
15 """
16 @staticmethod
17 def CreateAnalysisId(master_name, builder_name, step_name):
18 return '%s/%s/%s' % (master_name, builder_name, step_name)
19
20 @ndb.ComputedProperty
21 def master_name(self):
stgao 2016/07/08 22:51:27 Same here for using BaseBuildModel class.
caiw 2016/07/14 00:59:40 Done.
22 return self.key.pairs()[0][1].split('/')[0]
23
24 @ndb.ComputedProperty
25 def builder_name(self):
26 return self.key.pairs()[0][1].split('/')[1]
27
28 @ndb.ComputedProperty
29 def step_name(self):
30 return self.key.pairs()[0][1].split('/')[2]
31
32 @ndb.ComputedProperty
33 def build_number(self):
34 return 0
35
36 @staticmethod
37 def _CreateKey(master_name, builder_name, step_name): # pragma: no cover
38 return ndb.Key('MasterFlakeAnalysis',
39 MasterFlakeAnalysis.CreateAnalysisId(
40 master_name, builder_name, step_name))
41
42 @staticmethod
43 def Create(master_name, builder_name, step_name): # pragma: no cover
44 return MasterFlakeAnalysis(
45
46 key=MasterFlakeAnalysis._CreateKey(
47 master_name, builder_name, step_name))
48
49 @staticmethod
50 def Get(master_name, builder_name, step_name): # pragma: no cover
51 return MasterFlakeAnalysis._CreateKey(
52 master_name, builder_name, step_name).get()
53
54 def generate_data(self):
55 data = []
56 # Generates data in the format which the template can read
57 # Go through list of flake_swarming_tasks
58 for fst in self.flake_swarming_tasks:
59 # Go through list of flake_swarming_task_results
60 for fstr in fst.flake_swarming_task_results:
61 # Append results to a list (this is a placeholder)
62 data.append((fstr.successes, fstr.tries,
63 fstr.master_name(), fstr.builder_name(),
64 fstr.step_name(), fstr.build_number(),
65 fstr.test_name()))
66 # List of tested build_numbers and their corresponding success rates.
67 # We need to keep these sorted manually.
68 # This is not going to work when we have multiple tests.
69 build_numbers = ndb.IntegerProperty(indexed=True, repeated=True)
70 success_rates = ndb.FloatProperty(indexed=False, repeated=True)
stgao 2016/07/08 22:51:27 Is the success rate per-test? If so, should we mak
caiw 2016/07/14 00:59:40 Done.
71 flake_swarming_tasks = ndb.KeyProperty(
72 kind='FlakeSwarmingTask', repeated=True)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698