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

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 chan'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
« no previous file with comments | « appengine/findit/model/flake/flake_swarming_task.py ('k') | no next file » | 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 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 model import analysis_status
8 from model.base_build_model import BaseBuildModel
9 from model.base_analysis import BaseAnalysis
10 from model.flake.flake_swarming_task import FlakeSwarmingTask
11
12 class MasterFlakeAnalysis(BaseAnalysis, BaseBuildModel):
13 """Represents an analysis of a candidate flaky test in a Chromium Waterfall.
14
15 """
16 @staticmethod
17 def CreateAnalysisId(master_name, builder_name,
18 build_number, step_name, test_name):
19 return '%s/%s/%s/%s/%s' % (master_name, builder_name,
20 build_number, step_name, test_name)
21
22 @ndb.ComputedProperty
23 def step_name(self):
24 return self.key.pairs()[0][1].split('/')[3]
25
26 @ndb.ComputedProperty
27 def test_name(self):
28 return self.key.pairs()[0][1].split('/')[4]
29
30 @staticmethod
31 def _CreateKey(master_name, builder_name, build_number,
32 step_name, test_name): # pragma: no cover
33 return ndb.Key('MasterFlakeAnalysis',
34 MasterFlakeAnalysis.CreateAnalysisId(
35 master_name, builder_name, build_number,
36 step_name, test_name))
37
38 @staticmethod
39 def Create(master_name, builder_name, build_number,
40 step_name, test_name): # pragma: no cover
41 return MasterFlakeAnalysis(
42 key=MasterFlakeAnalysis._CreateKey(
43 master_name, builder_name, build_number,
44 step_name, test_name))
45
46 @staticmethod
47 def Get(master_name, builder_name, build_number,
48 step_name, test_name): # pragma: no cover
49 return MasterFlakeAnalysis._CreateKey(
50 master_name, builder_name, build_number, step_name, test_name).get()
51
52 @staticmethod
53 def generate_data(flake_swarming_tasks):
chanli 2016/07/19 20:02:10 So this function is not needed any more?
caiw 2016/07/20 18:11:00 Correct - I think it would be easier to delete thi
54 data = []
55 # Generates data in the format which the template can read.
56 # Goes through list of flake_swarming_tasks.
57 for fst in flake_swarming_tasks:
58 # Append results to a list (this is a placeholder).
59 data.append((fst.successes, fst.tries,
60 fst.master_name(), fst.builder_name(),
61 fst.build_number(), fst.step_name(),
62 fst.test_name()))
63 return data
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
« no previous file with comments | « appengine/findit/model/flake/flake_swarming_task.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698