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 import logging | 5 import logging |
| 6 | 6 |
| 7 from collections import defaultdict | 7 from collections import defaultdict |
| 8 | 8 |
| 9 from model.flake.flake_swarming_task import FlakeSwarmingTask | 9 from model.flake.flake_swarming_task import FlakeSwarmingTask |
| 10 from model.flake.master_flake_analysis import DataPoint | 10 from model.flake.master_flake_analysis import DataPoint |
| (...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 46 | 46 |
| 47 tests_statuses = defaultdict(lambda: defaultdict(int)) | 47 tests_statuses = defaultdict(lambda: defaultdict(int)) |
| 48 | 48 |
| 49 if not output_json: | 49 if not output_json: |
| 50 return tests_statuses | 50 return tests_statuses |
| 51 | 51 |
| 52 for iteration in output_json.get('per_iteration_data'): | 52 for iteration in output_json.get('per_iteration_data'): |
| 53 for name, test_runs in iteration.iteritems(): | 53 for name, test_runs in iteration.iteritems(): |
| 54 tests_statuses[name]['total_run'] += len(test_runs) | 54 tests_statuses[name]['total_run'] += len(test_runs) |
| 55 for test_run in test_runs: | 55 for test_run in test_runs: |
| 56 tests_statuses[name][test_run['status']] += 1 | 56 tests_statuses[name][test_run['status']] += 1 |
|
chanli
2016/11/09 04:28:28
Until here the function for flake-swarms and water
lijeffrey
2016/11/09 10:18:10
Done.
| |
| 57 | 57 |
| 58 # Should query by test name, because some test has dependencies which | 58 # Should query by test name, because some test has dependencies which |
| 59 # are also run, like TEST and PRE_TEST in browser_tests. | 59 # are also run, like TEST and PRE_TEST in browser_tests. |
| 60 tries = tests_statuses.get(test_name, {}).get('total_run', 0) | 60 tries = tests_statuses.get(test_name, {}).get('total_run', 0) |
| 61 successes = tests_statuses.get(test_name, {}).get('SUCCESS', 0) | 61 successes = tests_statuses.get(test_name, {}).get('SUCCESS', 0) |
| 62 | 62 |
| 63 if tries > 0: | 63 if tries > 0: |
| 64 pass_rate = successes * 1.0 / tries | 64 pass_rate = successes * 1.0 / tries |
| 65 else: | 65 else: |
| 66 pass_rate = -1 # Special value to indicate test is not existing. | 66 pass_rate = -1 # Special value to indicate test is not existing. |
| (...skipping 28 matching lines...) Expand all Loading... | |
| 95 | 95 |
| 96 def _GetArgs(self, master_name, builder_name, build_number, | 96 def _GetArgs(self, master_name, builder_name, build_number, |
| 97 step_name, *args): | 97 step_name, *args): |
| 98 master_build_number = args[0] | 98 master_build_number = args[0] |
| 99 test_name = args[1] | 99 test_name = args[1] |
| 100 version_number = args[2] | 100 version_number = args[2] |
| 101 return (master_name, builder_name, build_number, step_name, | 101 return (master_name, builder_name, build_number, step_name, |
| 102 master_build_number, test_name, version_number) | 102 master_build_number, test_name, version_number) |
| 103 | 103 |
| 104 # Unused Argument - pylint: disable=W0612,W0613 | 104 # Unused Argument - pylint: disable=W0612,W0613 |
| 105 # Arguments number differs from overridden method - pylint: disable=W0221 | |
| 105 def _GetSwarmingTask(self, master_name, builder_name, build_number, | 106 def _GetSwarmingTask(self, master_name, builder_name, build_number, |
| 106 step_name, master_build_number, test_name, _): | 107 step_name, master_build_number, test_name, _): |
| 107 # Get the appropriate kind of Swarming Task (Flake). | 108 # Gets the appropriate kind of swarming task (FlakeSwarmingTask). |
| 108 return FlakeSwarmingTask.Get(master_name, builder_name, | 109 return FlakeSwarmingTask.Get(master_name, builder_name, build_number, |
| 109 build_number, step_name, test_name) | 110 step_name, test_name) |
| OLD | NEW |