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

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

Issue 2362133003: [swarming/api] Add text in to indicate whether a shard is failing (RELAND) (Closed)
Patch Set: Rebase [retrain] Created 4 years, 2 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 logging 5 import logging
6 import datetime 6 import datetime
7 import functools 7 import functools
8 8
9 from recipe_engine import recipe_api 9 from recipe_engine import recipe_api
10 10
(...skipping 820 matching lines...) Expand 10 before | Expand all | Expand 10 after
831 # recipe_api.StepFailure exception from the collect step above. Instead 831 # recipe_api.StepFailure exception from the collect step above. Instead
832 # it is being allowed to propagate after the results have been parsed. 832 # it is being allowed to propagate after the results have been parsed.
833 try: 833 try:
834 step_result = self.m.step.active_result 834 step_result = self.m.step.active_result
835 outdir_json = self.m.json.dumps(step_result.raw_io.output_dir, indent=2) 835 outdir_json = self.m.json.dumps(step_result.raw_io.output_dir, indent=2)
836 step_result.presentation.logs['outdir_json'] = outdir_json.splitlines() 836 step_result.presentation.logs['outdir_json'] = outdir_json.splitlines()
837 837
838 # Check if it's an internal failure. 838 # Check if it's an internal failure.
839 summary = self.m.json.loads( 839 summary = self.m.json.loads(
840 step_result.raw_io.output_dir['summary.json']) 840 step_result.raw_io.output_dir['summary.json'])
841 if any(shard['internal_failure'] for shard in summary['shards']): 841 if any(not shard or shard['internal_failure']
842 for shard in summary['shards']):
842 raise recipe_api.InfraFailure('Internal swarming failure.') 843 raise recipe_api.InfraFailure('Internal swarming failure.')
843 844
844 # Always show the shards' links in the collect step. (It looks 845 # Always show the shards' links in the collect step. (It looks
845 # like show_isolated_out_in_collect_step is false by default 846 # like show_isolated_out_in_collect_step is false by default
846 # in recipe runs.) 847 # in recipe runs.)
847 links = step_result.presentation.links 848 links = step_result.presentation.links
848 for index in xrange(task.shards): 849 for index in xrange(task.shards):
849 url = task.get_shard_view_url(index) 850 url = task.get_shard_view_url(index)
851 if summary['shards'][index].get('exit_code', None) != '0':
852 display_text = 'shard #%d (failed)' % index
853 else:
854 display_text = 'shard #%d' % index
850 if url: 855 if url:
851 links['shard #%d' % index] = url 856 links[display_text] = url
852 857
853 step_result.isolated_script_results = \ 858 step_result.isolated_script_results = \
854 self._merge_isolated_script_shards(task, step_result) 859 self._merge_isolated_script_shards(task, step_result)
855 860
856 # Obtain chartjson results if present 861 # Obtain chartjson results if present
857 step_result.isolated_script_chartjson_results = \ 862 step_result.isolated_script_chartjson_results = \
858 self._merge_isolated_script_chartjson_ouput_shards(task, step_result) 863 self._merge_isolated_script_chartjson_ouput_shards(task, step_result)
859 864
860 self._display_pending(summary, step_result.presentation) 865 self._display_pending(summary, step_result.presentation)
861 except Exception as e: 866 except Exception as e:
(...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after
1047 1052
1048 def get_shard_view_url(self, index): 1053 def get_shard_view_url(self, index):
1049 """Returns URL of HTML page with shard details or None if not available. 1054 """Returns URL of HTML page with shard details or None if not available.
1050 1055
1051 Works only after the task has been successfully triggered. 1056 Works only after the task has been successfully triggered.
1052 """ 1057 """
1053 if self._trigger_output and self._trigger_output.get('tasks'): 1058 if self._trigger_output and self._trigger_output.get('tasks'):
1054 for shard_dict in self._trigger_output['tasks'].itervalues(): 1059 for shard_dict in self._trigger_output['tasks'].itervalues():
1055 if shard_dict['shard_index'] == index: 1060 if shard_dict['shard_index'] == index:
1056 return shard_dict['view_url'] 1061 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