| 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(not shard or shard['internal_failure'] | 787 if any(shard['internal_failure'] for shard in summary['shards']): |
| 788 for shard in summary['shards']): | |
| 789 raise recipe_api.InfraFailure('Internal swarming failure.') | 788 raise recipe_api.InfraFailure('Internal swarming failure.') |
| 790 | 789 |
| 791 # Always show the shards' links in the collect step. (It looks | 790 # Always show the shards' links in the collect step. (It looks |
| 792 # like show_isolated_out_in_collect_step is false by default | 791 # like show_isolated_out_in_collect_step is false by default |
| 793 # in recipe runs.) | 792 # in recipe runs.) |
| 794 links = step_result.presentation.links | 793 links = step_result.presentation.links |
| 795 for index in xrange(task.shards): | 794 for index in xrange(task.shards): |
| 796 url = task.get_shard_view_url(index) | 795 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 | |
| 801 if url: | 796 if url: |
| 802 links[display_text] = url | 797 links['shard #%d' % index] = url |
| 803 | 798 |
| 804 step_result.isolated_script_results = \ | 799 step_result.isolated_script_results = \ |
| 805 self._merge_isolated_script_shards(task, step_result) | 800 self._merge_isolated_script_shards(task, step_result) |
| 806 | 801 |
| 807 self._display_pending(summary, step_result.presentation) | 802 self._display_pending(summary, step_result.presentation) |
| 808 except Exception as e: | 803 except Exception as e: |
| 809 self.m.step.active_result.presentation.logs['no_results_exc'] = [str(e)] | 804 self.m.step.active_result.presentation.logs['no_results_exc'] = [str(e)] |
| 810 self.m.step.active_result.isolated_script_results = None | 805 self.m.step.active_result.isolated_script_results = None |
| 811 | 806 |
| 812 def _get_step_name(self, prefix, task): | 807 def _get_step_name(self, prefix, task): |
| (...skipping 181 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 994 | 989 |
| 995 def get_shard_view_url(self, index): | 990 def get_shard_view_url(self, index): |
| 996 """Returns URL of HTML page with shard details or None if not available. | 991 """Returns URL of HTML page with shard details or None if not available. |
| 997 | 992 |
| 998 Works only after the task has been successfully triggered. | 993 Works only after the task has been successfully triggered. |
| 999 """ | 994 """ |
| 1000 if self._trigger_output and self._trigger_output.get('tasks'): | 995 if self._trigger_output and self._trigger_output.get('tasks'): |
| 1001 for shard_dict in self._trigger_output['tasks'].itervalues(): | 996 for shard_dict in self._trigger_output['tasks'].itervalues(): |
| 1002 if shard_dict['shard_index'] == index: | 997 if shard_dict['shard_index'] == index: |
| 1003 return shard_dict['view_url'] | 998 return shard_dict['view_url'] |
| OLD | NEW |