Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(67)

Side by Side Diff: scripts/slave/recipe_modules/swarming/api.py

Issue 2150993005: Make _merge_isolated_script_shards robust to harness failures. (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build.git@master
Patch Set: Addressed review feedback from vadimsh. Created 4 years, 5 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/test_utils/test_api.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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
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']
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/test_utils/test_api.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698