Chromium Code Reviews| OLD | NEW |
|---|---|
| (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 | |
|
lijeffrey
2016/07/19 22:32:21
nit: For docstrings using """ try to get a 1 line
caiw
2016/07/20 18:11:00
Done.
| |
| 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 # List of tested build_numbers and their corresponding success rates. | |
| 53 # We need to keep these sorted manually. | |
| 54 build_numbers = ndb.IntegerProperty(indexed=True, repeated=True) | |
| 55 success_rates = ndb.FloatProperty(indexed=False, repeated=True) | |
| 56 flake_swarming_tasks = ndb.KeyProperty( | |
| 57 kind='FlakeSwarmingTask', repeated=True) | |
| OLD | NEW |