OLD | NEW |
1 # Copyright 2015 The Chromium Authors. All rights reserved. | 1 # Copyright 2015 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 """Processes tests and creates new Anomaly entities. | 5 """Processes tests and creates new Anomaly entities. |
6 | 6 |
7 This module contains the ProcessTest function, which searches the recent | 7 This module contains the ProcessTest function, which searches the recent |
8 points in a test for potential regressions or improvements, and creates | 8 points in a test for potential regressions or improvements, and creates |
9 new Anomaly entities. | 9 new Anomaly entities. |
10 """ | 10 """ |
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 change_points = FindChangePointsForTest(rows, config) | 79 change_points = FindChangePointsForTest(rows, config) |
80 change_points = yield _FilterAnomaliesFoundInRef( | 80 change_points = yield _FilterAnomaliesFoundInRef( |
81 change_points, test_key, len(rows)) | 81 change_points, test_key, len(rows)) |
82 | 82 |
83 anomalies = [_MakeAnomalyEntity(c, test, rows) for c in change_points] | 83 anomalies = [_MakeAnomalyEntity(c, test, rows) for c in change_points] |
84 | 84 |
85 # If no new anomalies were found, then we're done. | 85 # If no new anomalies were found, then we're done. |
86 if not anomalies: | 86 if not anomalies: |
87 return | 87 return |
88 | 88 |
89 logging.info('Found at least one anomaly in: %s', test.test_path) | 89 logging.info('Created %d anomalies', len(anomalies)) |
| 90 logging.info(' Test: %s', test_key.id()) |
| 91 logging.info(' Sheriff: %s', test.sheriff.id()) |
90 | 92 |
91 # Update the last_alerted_revision property of the test. | 93 # Update the last_alerted_revision property of the test. |
92 test.last_alerted_revision = anomalies[-1].end_revision | 94 test.last_alerted_revision = anomalies[-1].end_revision |
93 yield test.put_async() | 95 yield test.put_async() |
94 yield alert_group.GroupAlertsAsync( | 96 yield alert_group.GroupAlertsAsync( |
95 anomalies, utils.TestSuiteName(test.key), 'Anomaly') | 97 anomalies, utils.TestSuiteName(test.key), 'Anomaly') |
96 | 98 |
97 # TODO(simonhatch): email_sheriff.EmailSheriff() isn't a tasklet yet, so this | 99 # TODO(simonhatch): email_sheriff.EmailSheriff() isn't a tasklet yet, so this |
98 # code will run serially. | 100 # code will run serially. |
99 # Email sheriff about any new regressions. | 101 # Email sheriff about any new regressions. |
(...skipping 279 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 Returns: | 381 Returns: |
380 True if it is improvement anomaly, otherwise False. | 382 True if it is improvement anomaly, otherwise False. |
381 """ | 383 """ |
382 if (median_before < median_after and | 384 if (median_before < median_after and |
383 test.improvement_direction == anomaly.UP): | 385 test.improvement_direction == anomaly.UP): |
384 return True | 386 return True |
385 if (median_before >= median_after and | 387 if (median_before >= median_after and |
386 test.improvement_direction == anomaly.DOWN): | 388 test.improvement_direction == anomaly.DOWN): |
387 return True | 389 return True |
388 return False | 390 return False |
OLD | NEW |