| 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 copy | 5 import copy |
| 6 import logging | 6 import logging |
| 7 import time | 7 import time |
| 8 | 8 |
| 9 from common.http_client_appengine import HttpClientAppengine as HttpClient | 9 from common.http_client_appengine import HttpClientAppengine as HttpClient |
| 10 from common.pipeline_wrapper import BasePipeline | 10 from common.pipeline_wrapper import BasePipeline |
| (...skipping 150 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 ref_task_id, http_client) | 161 ref_task_id, http_client) |
| 162 | 162 |
| 163 # 2. Update/Overwrite parameters for the re-run. | 163 # 2. Update/Overwrite parameters for the re-run. |
| 164 iterations_to_rerun = self._GetIterationsToRerun() | 164 iterations_to_rerun = self._GetIterationsToRerun() |
| 165 | 165 |
| 166 new_request = self._CreateNewSwarmingTaskRequest( | 166 new_request = self._CreateNewSwarmingTaskRequest( |
| 167 ref_task_id, ref_request, master_name, builder_name, build_number, | 167 ref_task_id, ref_request, master_name, builder_name, build_number, |
| 168 step_name, tests, iterations_to_rerun) | 168 step_name, tests, iterations_to_rerun) |
| 169 | 169 |
| 170 # 3. Trigger a new Swarming task to re-run the failed tests. | 170 # 3. Trigger a new Swarming task to re-run the failed tests. |
| 171 task_id = swarming_util.TriggerSwarmingTask(new_request, http_client) | 171 task_id, error = swarming_util.TriggerSwarmingTask(new_request, http_client) |
| 172 | 172 |
| 173 # Save the task id. | 173 # Update swarming task info. |
| 174 swarming_task = self._GetSwarmingTask(*call_args) | 174 swarming_task = self._GetSwarmingTask(*call_args) |
| 175 swarming_task.task_id = task_id | 175 swarming_task.task_id = task_id |
| 176 swarming_task.parameters['tests'] = tests | 176 swarming_task.parameters['tests'] = tests |
| 177 swarming_task.parameters['iterations_to_rerun'] = iterations_to_rerun | 177 swarming_task.parameters['iterations_to_rerun'] = iterations_to_rerun |
| 178 swarming_task.parameters['ref_name'] = swarming_util.GetTagValue( | 178 swarming_task.parameters['ref_name'] = swarming_util.GetTagValue( |
| 179 new_request.tags, 'ref_name') | 179 new_request.tags, 'ref_name') |
| 180 |
| 181 if error: |
| 182 swarming_task.error = error |
| 183 else: |
| 184 logging.info('A Swarming task was triggered:%s', task_id) |
| 185 |
| 180 swarming_task.put() | 186 swarming_task.put() |
| 181 | |
| 182 logging.info('A Swarming task was triggered:%s', task_id) | |
| 183 return task_id | 187 return task_id |
| OLD | NEW |