Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 # Copyright 2016 The Chromium Authors. All rights reserved. | 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 | 2 # Use of this source code is governed by a BSD-style license that can be |
| 3 # found in the LICENSE file. | 3 # found in the LICENSE file. |
| 4 | 4 |
| 5 from collections import defaultdict | 5 from collections import defaultdict |
| 6 | 6 |
| 7 from google.appengine.ext import ndb | 7 from google.appengine.ext import ndb |
| 8 | 8 |
| 9 from model.base_build_model import BaseBuildModel | 9 from model.base_build_model import BaseBuildModel |
| 10 from model import analysis_status | 10 from model import analysis_status |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 39 # parameters need to be stored and analyzed later. | 39 # parameters need to be stored and analyzed later. |
| 40 parameters = ndb.JsonProperty(default={}, indexed=False, compressed=True) | 40 parameters = ndb.JsonProperty(default={}, indexed=False, compressed=True) |
| 41 | 41 |
| 42 @property | 42 @property |
| 43 def classified_tests(self): | 43 def classified_tests(self): |
| 44 """Classification of tests into lists of reliable and flaky tests. | 44 """Classification of tests into lists of reliable and flaky tests. |
| 45 | 45 |
| 46 example format would be: | 46 example format would be: |
| 47 { | 47 { |
| 48 'flaky_tests': ['test1', 'test2', ...], | 48 'flaky_tests': ['test1', 'test2', ...], |
| 49 'reliable_tests': ['test3', ...] | 49 'reliable_tests': ['test3', ...] |
|
lijeffrey
2016/06/01 19:27:02
Update the docstring too to put 'other_tests'.
si
chanli
2016/06/02 22:40:09
Done. Essentially a skipped test is a test with a
| |
| 50 } | 50 } |
| 51 """ | 51 """ |
| 52 classified_tests = defaultdict(list) | 52 classified_tests = defaultdict(list) |
| 53 for test_name, test_statuses in self.tests_statuses.iteritems(): | 53 for test_name, test_statuses in self.tests_statuses.iteritems(): |
| 54 if test_statuses.get('SUCCESS'): # Test passed for some runs, flaky. | 54 if test_statuses.get('SUCCESS'): # Test passed for some runs, flaky. |
| 55 classified_tests['flaky_tests'].append(test_name) | 55 classified_tests['flaky_tests'].append(test_name) |
| 56 elif test_statuses.get('SKIPPED') or test_statuses.get('UNKNOWN'): | |
| 57 classified_tests['other_tests'].append(test_name) | |
| 56 else: | 58 else: |
| 57 # Here we consider a 'non-flaky' test to be 'reliable'. | 59 # Here we consider a 'non-flaky' test to be 'reliable'. |
| 58 # TODO(chanli): Check more test statuses. | 60 # TODO(chanli): Check more test statuses. |
| 59 classified_tests['reliable_tests'].append(test_name) | 61 classified_tests['reliable_tests'].append(test_name) |
| 60 return classified_tests | 62 return classified_tests |
| 61 | 63 |
| 62 @staticmethod | 64 @staticmethod |
| 63 def _CreateKey( | 65 def _CreateKey( |
| 64 master_name, builder_name, build_number, step_name): # pragma: no cover | 66 master_name, builder_name, build_number, step_name): # pragma: no cover |
| 65 build_id = BaseBuildModel.CreateBuildId( | 67 build_id = BaseBuildModel.CreateBuildId( |
| 66 master_name, builder_name, build_number) | 68 master_name, builder_name, build_number) |
| 67 return ndb.Key('WfBuild', build_id, 'WfSwarmingTask', step_name) | 69 return ndb.Key('WfBuild', build_id, 'WfSwarmingTask', step_name) |
| 68 | 70 |
| 69 @staticmethod | 71 @staticmethod |
| 70 def Create( | 72 def Create( |
| 71 master_name, builder_name, build_number, step_name): # pragma: no cover | 73 master_name, builder_name, build_number, step_name): # pragma: no cover |
| 72 return WfSwarmingTask( | 74 return WfSwarmingTask( |
| 73 key=WfSwarmingTask._CreateKey( | 75 key=WfSwarmingTask._CreateKey( |
| 74 master_name, builder_name, build_number, step_name)) | 76 master_name, builder_name, build_number, step_name)) |
| 75 | 77 |
| 76 @staticmethod | 78 @staticmethod |
| 77 def Get( | 79 def Get( |
| 78 master_name, builder_name, build_number, step_name): # pragma: no cover | 80 master_name, builder_name, build_number, step_name): # pragma: no cover |
| 79 return WfSwarmingTask._CreateKey( | 81 return WfSwarmingTask._CreateKey( |
| 80 master_name, builder_name, build_number, step_name).get() | 82 master_name, builder_name, build_number, step_name).get() |
| OLD | NEW |