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

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: Addressed 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
chanli 2016/07/19 19:12:20 Is constants used?
caiw 2016/07/19 19:36:09 Done.
8 from model import analysis_status
9 from model.base_build_model import BaseBuildModel
10 from model.base_analysis import BaseAnalysis
11 from model.flake.flake_swarming_task import FlakeSwarmingTask
12
13 class MasterFlakeAnalysis(BaseAnalysis, BaseBuildModel):
14 """Represents an analysis of a candidate flaky test in a Chromium Waterfall.
15
16 """
17 @staticmethod
18 def CreateAnalysisId(master_name, builder_name,
19 build_number, step_name, test_name):
20 return '%s/%s/%s/%s/%s' % (master_name, builder_name,
21 build_number, step_name, test_name)
22
23 @ndb.ComputedProperty
24 def step_name(self):
25 return self.key.pairs()[0][1].split('/')[3]
26
27 @ndb.ComputedProperty
28 def test_name(self):
29 return self.key.pairs()[0][1].split('/')[4]
30
31 @staticmethod
32 def _CreateKey(master_name, builder_name, build_number,
33 step_name, test_name): # pragma: no cover
34 return ndb.Key('MasterFlakeAnalysis',
35 MasterFlakeAnalysis.CreateAnalysisId(
36 master_name, builder_name, build_number,
37 step_name, test_name))
38
39 @staticmethod
40 def Create(master_name, builder_name, build_number,
41 step_name, test_name): # pragma: no cover
42 return MasterFlakeAnalysis(
43 key=MasterFlakeAnalysis._CreateKey(
44 master_name, builder_name, build_number,
45 step_name, test_name))
46
47 @staticmethod
48 def Get(master_name, builder_name, build_number,
49 step_name, test_name): # pragma: no cover
50 return MasterFlakeAnalysis._CreateKey(
51 master_name, builder_name, build_number, step_name, test_name).get()
52
53 @staticmethod
54 def generate_data(flake_swarming_tasks):
55 data = []
56 # Generates data in the format which the template can read
chanli 2016/07/19 19:12:20 Nit: add '.' at the end of comment
caiw 2016/07/19 19:36:10 Done.
57 # Go through list of flake_swarming_tasks
chanli 2016/07/19 19:12:20 Nit: Goes
caiw 2016/07/19 19:36:10 Done.
58 for fst in flake_swarming_tasks:
59 # Append results to a list (this is a placeholder)
60 data.append((fst.successes, fst.tries,
61 fst.master_name(), fst.builder_name(),
62 fst.step_name(), fst.build_number(),
chanli 2016/07/19 19:12:20 Not sure if I missed, but where is fst.master_name
caiw 2016/07/19 19:36:10 I think those are from base_build_model? I switch
63 fst.test_name()))
64
65 # List of tested build_numbers and their corresponding success rates.
66 # We need to keep these sorted manually.
67 build_numbers = ndb.IntegerProperty(indexed=True, repeated=True)
68 success_rates = ndb.FloatProperty(indexed=False, repeated=True)
69 flake_swarming_tasks = ndb.KeyProperty(
70 kind='FlakeSwarmingTask', repeated=True)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698