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 import recipe_api | 8 from recipe_engine import recipe_api |
9 | 9 |
10 | 10 |
(...skipping 766 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
777 # recipe_api.StepFailure exception from the collect step above. Instead | 777 # recipe_api.StepFailure exception from the collect step above. Instead |
778 # it is being allowed to propagate after the results have been parsed. | 778 # it is being allowed to propagate after the results have been parsed. |
779 try: | 779 try: |
780 step_result = self.m.step.active_result | 780 step_result = self.m.step.active_result |
781 outdir_json = self.m.json.dumps(step_result.raw_io.output_dir, indent=2) | 781 outdir_json = self.m.json.dumps(step_result.raw_io.output_dir, indent=2) |
782 step_result.presentation.logs['outdir_json'] = outdir_json.splitlines() | 782 step_result.presentation.logs['outdir_json'] = outdir_json.splitlines() |
783 | 783 |
784 # Check if it's an internal failure. | 784 # Check if it's an internal failure. |
785 summary = self.m.json.loads( | 785 summary = self.m.json.loads( |
786 step_result.raw_io.output_dir['summary.json']) | 786 step_result.raw_io.output_dir['summary.json']) |
787 if any(shard['internal_failure'] for shard in summary['shards']): | 787 if any(not shard or shard['internal_failure'] |
788 for shard in summary['shards']): | |
788 raise recipe_api.InfraFailure('Internal swarming failure.') | 789 raise recipe_api.InfraFailure('Internal swarming failure.') |
789 | 790 |
790 # Always show the shards' links in the collect step. (It looks | 791 # Always show the shards' links in the collect step. (It looks |
791 # like show_isolated_out_in_collect_step is false by default | 792 # like show_isolated_out_in_collect_step is false by default |
792 # in recipe runs.) | 793 # in recipe runs.) |
793 links = step_result.presentation.links | 794 links = step_result.presentation.links |
794 for index in xrange(task.shards): | 795 for index in xrange(task.shards): |
795 url = task.get_shard_view_url(index) | 796 url = task.get_shard_view_url(index) |
797 if summary['shards'][index].get('exit_code', None) != 0: | |
798 display_text = 'shard #%d (failed)' % index | |
799 else: | |
800 display_text = 'shard #%d' % index | |
nednguyen
2016/09/22 21:47:07
Now I am missing test coverage at this line becaus
| |
796 if url: | 801 if url: |
797 links['shard #%d' % index] = url | 802 links[display_text] = url |
798 | 803 |
799 step_result.isolated_script_results = \ | 804 step_result.isolated_script_results = \ |
800 self._merge_isolated_script_shards(task, step_result) | 805 self._merge_isolated_script_shards(task, step_result) |
801 | 806 |
802 self._display_pending(summary, step_result.presentation) | 807 self._display_pending(summary, step_result.presentation) |
803 except Exception as e: | 808 except Exception as e: |
804 self.m.step.active_result.presentation.logs['no_results_exc'] = [str(e)] | 809 self.m.step.active_result.presentation.logs['no_results_exc'] = [str(e)] |
805 self.m.step.active_result.isolated_script_results = None | 810 self.m.step.active_result.isolated_script_results = None |
806 | 811 |
807 def _get_step_name(self, prefix, task): | 812 def _get_step_name(self, prefix, task): |
(...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
989 | 994 |
990 def get_shard_view_url(self, index): | 995 def get_shard_view_url(self, index): |
991 """Returns URL of HTML page with shard details or None if not available. | 996 """Returns URL of HTML page with shard details or None if not available. |
992 | 997 |
993 Works only after the task has been successfully triggered. | 998 Works only after the task has been successfully triggered. |
994 """ | 999 """ |
995 if self._trigger_output and self._trigger_output.get('tasks'): | 1000 if self._trigger_output and self._trigger_output.get('tasks'): |
996 for shard_dict in self._trigger_output['tasks'].itervalues(): | 1001 for shard_dict in self._trigger_output['tasks'].itervalues(): |
997 if shard_dict['shard_index'] == index: | 1002 if shard_dict['shard_index'] == index: |
998 return shard_dict['view_url'] | 1003 return shard_dict['view_url'] |
OLD | NEW |