| OLD | NEW |
| 1 # Copyright 2014 The Chromium Authors. All rights reserved. | 1 # Copyright 2014 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 datetime | 5 import datetime |
| 6 import functools | 6 import functools |
| 7 | 7 |
| 8 from recipe_engine.types import freeze | 8 from recipe_engine.types import freeze |
| 9 from recipe_engine import recipe_api | 9 from recipe_engine import recipe_api |
| 10 | 10 |
| (...skipping 725 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 736 merged_results = { | 736 merged_results = { |
| 737 'successes': [], | 737 'successes': [], |
| 738 'failures': [], | 738 'failures': [], |
| 739 'valid': True, | 739 'valid': True, |
| 740 } | 740 } |
| 741 for i in xrange(task.shards): | 741 for i in xrange(task.shards): |
| 742 path = self.m.path.join(str(i), 'output.json') | 742 path = self.m.path.join(str(i), 'output.json') |
| 743 if path not in step_result.raw_io.output_dir: | 743 if path not in step_result.raw_io.output_dir: |
| 744 raise Exception('no results from shard #%d' % i) | 744 raise Exception('no results from shard #%d' % i) |
| 745 results_raw = step_result.raw_io.output_dir[path] | 745 results_raw = step_result.raw_io.output_dir[path] |
| 746 results_json = self.m.json.loads(results_raw) | 746 try: |
| 747 results_json = self.m.json.loads(results_raw) |
| 748 except Exception as e: |
| 749 raise Exception('error decoding JSON results from shard #%d' % i) |
| 747 for key in merged_results: | 750 for key in merged_results: |
| 748 if key in results_json: | 751 if key in results_json: |
| 749 if isinstance(merged_results[key], list): | 752 if isinstance(merged_results[key], list): |
| 750 merged_results[key].extend(results_json[key]) | 753 merged_results[key].extend(results_json[key]) |
| 751 elif isinstance(merged_results[key], bool): | 754 elif isinstance(merged_results[key], bool): |
| 752 merged_results[key] = merged_results[key] and results_json[key] | 755 merged_results[key] = merged_results[key] and results_json[key] |
| 753 else: | 756 else: |
| 754 raise recipe_api.InfraFailure( | 757 raise recipe_api.InfraFailure( |
| 755 'Unknown key type ' + type(merged_results[key]) + | 758 'Unknown key type ' + type(merged_results[key]) + |
| 756 ' when handling key ' + key + '.') # pragma: no cover | 759 ' when handling key ' + key + '.') # pragma: no cover |
| (...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 995 | 998 |
| 996 def get_shard_view_url(self, index): | 999 def get_shard_view_url(self, index): |
| 997 """Returns URL of HTML page with shard details or None if not available. | 1000 """Returns URL of HTML page with shard details or None if not available. |
| 998 | 1001 |
| 999 Works only after the task has been successfully triggered. | 1002 Works only after the task has been successfully triggered. |
| 1000 """ | 1003 """ |
| 1001 if self._trigger_output and self._trigger_output.get('tasks'): | 1004 if self._trigger_output and self._trigger_output.get('tasks'): |
| 1002 for shard_dict in self._trigger_output['tasks'].itervalues(): | 1005 for shard_dict in self._trigger_output['tasks'].itervalues(): |
| 1003 if shard_dict['shard_index'] == index: | 1006 if shard_dict['shard_index'] == index: |
| 1004 return shard_dict['view_url'] | 1007 return shard_dict['view_url'] |
| OLD | NEW |