| 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 import base64 | 5 import base64 |
| 6 from collections import defaultdict | 6 from collections import defaultdict |
| 7 import json | 7 import json |
| 8 import logging | 8 import logging |
| 9 import urllib | 9 import urllib |
| 10 import zlib | 10 import zlib |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 } | 41 } |
| 42 | 42 |
| 43 | 43 |
| 44 # Urlfetch error codes. | 44 # Urlfetch error codes. |
| 45 URLFETCH_DOWNLOAD_ERROR = 100 | 45 URLFETCH_DOWNLOAD_ERROR = 100 |
| 46 URLFETCH_DEADLINE_EXCEEDED_ERROR = 110 | 46 URLFETCH_DEADLINE_EXCEEDED_ERROR = 110 |
| 47 URLFETCH_CONNECTION_CLOSED_ERROR = 120 | 47 URLFETCH_CONNECTION_CLOSED_ERROR = 120 |
| 48 EXCEEDED_MAX_RETRIES_ERROR = 210 | 48 EXCEEDED_MAX_RETRIES_ERROR = 210 |
| 49 | 49 |
| 50 | 50 |
| 51 # Outputs_ref is None. |
| 52 NO_TASK_OUTPUTS = 300 |
| 53 |
| 54 |
| 51 # Other/miscellaneous error codes. | 55 # Other/miscellaneous error codes. |
| 52 UNKNOWN = 1000 | 56 UNKNOWN = 1000 |
| 53 | 57 |
| 54 | 58 |
| 55 # Swarming task exit codes. | 59 # Swarming task exit codes. |
| 56 ALL_TESTS_PASSED = 0 | 60 ALL_TESTS_PASSED = 0 |
| 57 SOME_TESTS_FAILED = 1 | 61 SOME_TESTS_FAILED = 1 |
| 58 TASK_FAILED = 2 | 62 TASK_FAILED = 2 |
| 59 | 63 |
| 60 # Swarming task exit code descriptions. | 64 # Swarming task exit code descriptions. |
| (...skipping 201 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 262 if not data: | 266 if not data: |
| 263 return False | 267 return False |
| 264 | 268 |
| 265 tag_name = 'stepname' | 269 tag_name = 'stepname' |
| 266 build_isolated_data = defaultdict(list) | 270 build_isolated_data = defaultdict(list) |
| 267 for item in data: | 271 for item in data: |
| 268 if item['failure'] and not item['internal_failure']: | 272 if item['failure'] and not item['internal_failure']: |
| 269 # Only retrieves test results from tasks which have failures and | 273 # Only retrieves test results from tasks which have failures and |
| 270 # the failure should not be internal infrastructure failure. | 274 # the failure should not be internal infrastructure failure. |
| 271 swarming_step_name = GetTagValue(item['tags'], tag_name) | 275 swarming_step_name = GetTagValue(item['tags'], tag_name) |
| 272 if swarming_step_name in failed_steps: | 276 if swarming_step_name in failed_steps and item.get('outputs_ref'): |
| 273 isolated_data = _GenerateIsolatedData(item['outputs_ref']) | 277 isolated_data = _GenerateIsolatedData(item['outputs_ref']) |
| 274 build_isolated_data[swarming_step_name].append(isolated_data) | 278 build_isolated_data[swarming_step_name].append(isolated_data) |
| 275 | 279 |
| 276 new_steps = [] | 280 new_steps = [] |
| 277 for step_name in build_isolated_data: | 281 for step_name in build_isolated_data: |
| 278 failed_steps[step_name]['list_isolated_data'] = ( | 282 failed_steps[step_name]['list_isolated_data'] = ( |
| 279 build_isolated_data[step_name]) | 283 build_isolated_data[step_name]) |
| 280 | 284 |
| 281 # Create WfStep object for all the failed steps. | 285 # Create WfStep object for all the failed steps. |
| 282 step = WfStep.Create(master_name, builder_name, build_number, step_name) | 286 step = WfStep.Create(master_name, builder_name, build_number, step_name) |
| (...skipping 188 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 471 for isolated_data in list_isolated_data: | 475 for isolated_data in list_isolated_data: |
| 472 output_json, _ = _DownloadTestResults(isolated_data, http_client) | 476 output_json, _ = _DownloadTestResults(isolated_data, http_client) |
| 473 if not output_json: | 477 if not output_json: |
| 474 # TODO(lijeffrey): Report/handle error returned from _DownloadTestResults. | 478 # TODO(lijeffrey): Report/handle error returned from _DownloadTestResults. |
| 475 return None | 479 return None |
| 476 shard_results.append(output_json) | 480 shard_results.append(output_json) |
| 477 | 481 |
| 478 if len(list_isolated_data) == 1: | 482 if len(list_isolated_data) == 1: |
| 479 return shard_results[0] | 483 return shard_results[0] |
| 480 return _MergeSwarmingTestShards(shard_results) | 484 return _MergeSwarmingTestShards(shard_results) |
| OLD | NEW |