| 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 | |
| 6 import datetime | 5 import datetime |
| 7 import logging | 6 import logging |
| 8 import time | 7 import time |
| 9 | 8 |
| 10 from common.http_client_appengine import HttpClientAppengine as HttpClient | 9 from common.http_client_appengine import HttpClientAppengine as HttpClient |
| 11 from common.pipeline_wrapper import BasePipeline | 10 from common.pipeline_wrapper import BasePipeline |
| 12 from model import analysis_status | 11 from model import analysis_status |
| 13 from waterfall import swarming_util | 12 from waterfall import swarming_util |
| 14 from waterfall import waterfall_config | 13 from waterfall import waterfall_config |
| 15 | 14 |
| (...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 '_GetSwarmingTask should be implemented in the child class') | 48 '_GetSwarmingTask should be implemented in the child class') |
| 50 | 49 |
| 51 def _GetArgs(self): | 50 def _GetArgs(self): |
| 52 # Return list of arguments to call _CheckTestsRunStatuses with - output_json | 51 # Return list of arguments to call _CheckTestsRunStatuses with - output_json |
| 53 # Should be overwritten by subclass. | 52 # Should be overwritten by subclass. |
| 54 raise NotImplementedError( | 53 raise NotImplementedError( |
| 55 '_GetArgs should be implemented in the child class') | 54 '_GetArgs should be implemented in the child class') |
| 56 | 55 |
| 57 # Arguments number differs from overridden method - pylint: disable=W0221 | 56 # Arguments number differs from overridden method - pylint: disable=W0221 |
| 58 def run(self, master_name, builder_name, build_number, | 57 def run(self, master_name, builder_name, build_number, |
| 59 step_name, task_id, *args): # pragma: no cover. | 58 step_name, task_id, *args): # pragma: no cover. |
| 60 """ | 59 """ |
| 61 Args: | 60 Args: |
| 62 master_name (str): The master name. | 61 master_name (str): The master name. |
| 63 builder_name (str): The builder name. | 62 builder_name (str): The builder name. |
| 64 build_number (str): The build number. | 63 build_number (str): The build number. |
| 65 step_name (str): The failed test step name. | 64 step_name (str): The failed test step name. |
| 66 task_id (str): Id for the swarming task which is triggered by Findit. | 65 task_id (str): Id for the swarming task which is triggered by Findit. |
| 67 | 66 |
| 68 Returns: | 67 Returns: |
| 69 A dict of lists for reliable/flaky tests. | 68 A dict of lists for reliable/flaky tests. |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 123 task.status = analysis_status.RUNNING | 122 task.status = analysis_status.RUNNING |
| 124 task.put() | 123 task.put() |
| 125 time.sleep(server_query_interval_seconds) | 124 time.sleep(server_query_interval_seconds) |
| 126 if time.time() > deadline: | 125 if time.time() > deadline: |
| 127 # Updates status as ERROR. | 126 # Updates status as ERROR. |
| 128 task = self._GetSwarmingTask(*call_args) | 127 task = self._GetSwarmingTask(*call_args) |
| 129 task.status = analysis_status.ERROR | 128 task.status = analysis_status.ERROR |
| 130 task.put() | 129 task.put() |
| 131 logging.error('Swarming task timed out after %d hours.' % timeout_hours) | 130 logging.error('Swarming task timed out after %d hours.' % timeout_hours) |
| 132 break # Stops the loop and return. | 131 break # Stops the loop and return. |
| 133 # Update swarming task metadate. | 132 # Update swarming task metadata. |
| 134 task = self._GetSwarmingTask(*call_args) | 133 task = self._GetSwarmingTask(*call_args) |
| 135 task.created_time = self._ConvertDateTime(data.get('created_ts')) | 134 task.created_time = self._ConvertDateTime(data.get('created_ts')) |
| 136 task.started_time = self._ConvertDateTime(data.get('started_ts')) | 135 task.started_time = self._ConvertDateTime(data.get('started_ts')) |
| 137 task.completed_time = self._ConvertDateTime(data.get('completed_ts')) | 136 task.completed_time = self._ConvertDateTime(data.get('completed_ts')) |
| 138 task.put() | 137 task.put() |
| 139 | 138 |
| 140 return step_name, step_name_no_platform | 139 return step_name, step_name_no_platform |
| OLD | NEW |