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

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

Issue 1720873002: swarming: always append task's OS dimension to step name (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/build
Patch Set: Created 4 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/swarming/example.expected/basic_0.4.json » ('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 458 matching lines...) Expand 10 before | Expand all | Expand 10 after
469 assert isinstance(value, basestring), value 469 assert isinstance(value, basestring), value
470 args.extend(['--dimension', name, value]) 470 args.extend(['--dimension', name, value])
471 for name, value in sorted(task.env.iteritems()): 471 for name, value in sorted(task.env.iteritems()):
472 assert isinstance(value, basestring), value 472 assert isinstance(value, basestring), value
473 args.extend(['--env', name, value]) 473 args.extend(['--env', name, value])
474 474
475 # Default tags. 475 # Default tags.
476 tags = set(task.tags) 476 tags = set(task.tags)
477 tags.update(self._default_tags) 477 tags.update(self._default_tags)
478 tags.add('data:' + task.isolated_hash) 478 tags.add('data:' + task.isolated_hash)
479 tags.add('name:' + task.title) 479 tags.add('name:' + task.title)
M-A Ruel 2016/02/22 16:11:49 The more I was thinking about it, while it's not r
Paweł Hajdan Jr. 2016/02/24 16:24:19 Sure, uploaded https://codereview.chromium.org/173
480 mastername = self.m.properties.get('mastername') 480 mastername = self.m.properties.get('mastername')
481 if mastername: 481 if mastername:
482 tags.add('master:' + mastername) 482 tags.add('master:' + mastername)
483 if task.buildername: 483 if task.buildername:
484 tags.add('buildername:' + task.buildername) 484 tags.add('buildername:' + task.buildername)
485 if task.buildnumber: 485 if task.buildnumber:
486 tags.add('buildnumber:%d' % task.buildnumber) 486 tags.add('buildnumber:%d' % task.buildnumber)
487 if task.dimensions.get('os'): 487 if task.dimensions.get('os'):
488 tags.add('os:' + task.dimensions['os']) 488 tags.add('os:' + task.dimensions['os'])
489 if self.m.properties.get('slavename'): 489 if self.m.properties.get('slavename'):
(...skipping 253 matching lines...) Expand 10 before | Expand all | Expand 10 after
743 step_result.isolated_script_results = self.m.json.loads(results_raw) 743 step_result.isolated_script_results = self.m.json.loads(results_raw)
744 744
745 self._display_pending(summary, step_result.presentation) 745 self._display_pending(summary, step_result.presentation)
746 except Exception as e: 746 except Exception as e:
747 self.m.step.active_result.presentation.logs['no_results_exc'] = [str(e)] 747 self.m.step.active_result.presentation.logs['no_results_exc'] = [str(e)]
748 self.m.step.active_result.isolated_script_results = None 748 self.m.step.active_result.isolated_script_results = None
749 749
750 def _get_step_name(self, prefix, task): 750 def _get_step_name(self, prefix, task):
751 """SwarmingTask -> name of a step of a waterfall. 751 """SwarmingTask -> name of a step of a waterfall.
752 752
753 Will take a task title (+ step name prefix) and optionally append 753 Will take a task title (+ step name prefix) and append OS dimension to it.
754 OS dimension to it in case the task is triggered on OS that is different
755 from OS this recipe is running on. It shortens step names for the most
756 common case of triggering a task on the same OS as one that recipe
757 is running on.
758 754
759 Args: 755 Args:
760 prefix: prefix to append to task title, like 'trigger'. 756 prefix: prefix to append to task title, like 'trigger'.
761 task: SwarmingTask instance. 757 task: SwarmingTask instance.
762 758
763 Returns: 759 Returns:
764 '[<prefix>] <task title> (on <OS>)' where <OS> is optional. 760 '[<prefix>] <task title> on <OS>'
765 """ 761 """
766 prefix = '[%s] ' % prefix if prefix else '' 762 prefix = '[%s] ' % prefix if prefix else ''
767
768 task_os = task.dimensions['os'] 763 task_os = task.dimensions['os']
769 bot_os = self.prefered_os_dimension(self.m.platform.name) 764 # Note: properly detecting dimensions of the bot the recipe is running
770 suffix = '' if task_os == bot_os else ' on %s' % task_os 765 # on is somewhat non-trivial. It is not safe to assume it uses default
771 766 # or preferred dimensions for its OS. For example, the version of the OS
772 return ''.join((prefix, task.title, suffix)) 767 # can differ.
768 return ''.join((prefix, task.title, ' on %s' % task_os))
773 769
774 def get_collect_cmd_args(self, task): 770 def get_collect_cmd_args(self, task):
775 """SwarmingTask -> argument list for 'swarming.py' command.""" 771 """SwarmingTask -> argument list for 'swarming.py' command."""
776 args = [ 772 args = [
777 'collect', 773 'collect',
778 '--swarming', self.swarming_server, 774 '--swarming', self.swarming_server,
779 '--decorate', 775 '--decorate',
780 '--print-status-updates', 776 '--print-status-updates',
781 ] 777 ]
782 if self.verbose: 778 if self.verbose:
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after
928 924
929 def get_shard_view_url(self, index): 925 def get_shard_view_url(self, index):
930 """Returns URL of HTML page with shard details or None if not available. 926 """Returns URL of HTML page with shard details or None if not available.
931 927
932 Works only after the task has been successfully triggered. 928 Works only after the task has been successfully triggered.
933 """ 929 """
934 if self._trigger_output and self._trigger_output.get('tasks'): 930 if self._trigger_output and self._trigger_output.get('tasks'):
935 for shard_dict in self._trigger_output['tasks'].itervalues(): 931 for shard_dict in self._trigger_output['tasks'].itervalues():
936 if shard_dict['shard_index'] == index: 932 if shard_dict['shard_index'] == index:
937 return shard_dict['view_url'] 933 return shard_dict['view_url']
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/recipe_modules/swarming/example.expected/basic_0.4.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698