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

Side by Side Diff: infra/bots/recipes/swarm_trigger.py

Issue 2364693003: Add swarming task for nanobench upload (Closed)
Patch Set: Add CPU dimension Created 4 years, 3 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 | infra/bots/recipes/swarm_trigger.expected/Perf-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Trybot.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 2016 The Chromium Authors. All rights reserved. 1 # Copyright 2016 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 5
6 # Recipe module for Skia Swarming trigger. 6 # Recipe module for Skia Swarming trigger.
7 7
8 8
9 import os 9 import os
10 import json 10 import json
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after
58 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared', 58 'Test-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Shared',
59 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind', 59 'Test-Ubuntu-GCC-ShuttleA-GPU-GTX550Ti-x86_64-Release-Valgrind',
60 'Test-Win8-MSVC-ShuttleA-GPU-HD7770-x86_64-Release', 60 'Test-Win8-MSVC-ShuttleA-GPU-HD7770-x86_64-Release',
61 'Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Release', 61 'Test-Win8-MSVC-ShuttleB-CPU-AVX2-x86_64-Release',
62 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release', 62 'Test-iOS-Clang-iPad4-GPU-SGX554-Arm7-Release',
63 ], 63 ],
64 }, 64 },
65 } 65 }
66 66
67 67
68 UPLOAD_DIMENSIONS = {
69 'pool': 'Skia',
70 'os': 'Linux',
71 'cpu': 'x86-64-avx2',
72 'gpu': 'none',
73 }
74
75
68 def derive_compile_bot_name(api): 76 def derive_compile_bot_name(api):
69 builder_name = api.properties['buildername'] 77 builder_name = api.properties['buildername']
70 builder_cfg = api.builder_name_schema.DictForBuilderName(builder_name) 78 builder_cfg = api.builder_name_schema.DictForBuilderName(builder_name)
71 if builder_cfg['role'] == 'Housekeeper': 79 if builder_cfg['role'] == 'Housekeeper':
72 return 'Build-Ubuntu-GCC-x86_64-Release-Shared' 80 return 'Build-Ubuntu-GCC-x86_64-Release-Shared'
73 if builder_cfg['role'] in ('Test', 'Perf'): 81 if builder_cfg['role'] in ('Test', 'Perf'):
74 task_os = builder_cfg['os'] 82 task_os = builder_cfg['os']
75 extra_config = builder_cfg.get('extra_config', '') 83 extra_config = builder_cfg.get('extra_config', '')
76 if task_os == 'Android': 84 if task_os == 'Android':
77 if extra_config == 'Vulkan': 85 if extra_config == 'Vulkan':
(...skipping 99 matching lines...) Expand 10 before | Expand all | Expand 10 after
177 os.chmod(f, 0755) 185 os.chmod(f, 0755)
178 else: 186 else:
179 os.chmod(f, 0644) 187 os.chmod(f, 0644)
180 ''', 188 ''',
181 cwd=path) 189 cwd=path)
182 190
183 191
184 def trigger_task(api, task_name, builder, master, slave, buildnumber, 192 def trigger_task(api, task_name, builder, master, slave, buildnumber,
185 builder_cfg, got_revision, infrabots_dir, idempotent=False, 193 builder_cfg, got_revision, infrabots_dir, idempotent=False,
186 store_output=True, extra_isolate_hashes=None, expiration=None, 194 store_output=True, extra_isolate_hashes=None, expiration=None,
187 hard_timeout=None, io_timeout=None, cipd_packages=None): 195 hard_timeout=None, io_timeout=None, cipd_packages=None,
196 recipe_name=None, isolate_file=None, dimensions=None):
188 """Trigger the given bot to run as a Swarming task.""" 197 """Trigger the given bot to run as a Swarming task."""
189 # TODO(borenet): We're using Swarming directly to run the recipe through 198 # TODO(borenet): We're using Swarming directly to run the recipe through
190 # recipes.py. Once it's possible to track the state of a Buildbucket build, 199 # recipes.py. Once it's possible to track the state of a Buildbucket build,
191 # we should switch to use the trigger recipe module instead. 200 # we should switch to use the trigger recipe module instead.
192 201
193 properties = { 202 properties = {
194 'buildername': builder, 203 'buildername': builder,
195 'mastername': master, 204 'mastername': master,
196 'buildnumber': buildnumber, 205 'buildnumber': buildnumber,
197 'reason': 'Triggered by Skia swarm_trigger Recipe', 206 'reason': 'Triggered by Skia swarm_trigger Recipe',
198 'revision': got_revision, 207 'revision': got_revision,
199 'slavename': slave, 208 'slavename': slave,
200 'swarm_out_dir': '${ISOLATED_OUTDIR}', 209 'swarm_out_dir': '${ISOLATED_OUTDIR}',
201 } 210 }
202 if builder_cfg['is_trybot']: 211 if builder_cfg['is_trybot']:
203 if api.properties.get('patch_storage') == 'gerrit': 212 if api.properties.get('patch_storage') == 'gerrit':
204 properties['patch_storage'] = api.properties['patch_storage'] 213 properties['patch_storage'] = api.properties['patch_storage']
205 properties['repository'] = api.properties['repository'] 214 properties['repository'] = api.properties['repository']
206 properties['event.patchSet.ref'] = api.properties['event.patchSet.ref'] 215 properties['event.patchSet.ref'] = api.properties['event.patchSet.ref']
207 properties['event.change.number'] = api.properties['event.change.number'] 216 properties['event.change.number'] = api.properties['event.change.number']
208 else: 217 else:
209 properties['issue'] = str(api.properties['issue']) 218 properties['issue'] = str(api.properties['issue'])
210 properties['patchset'] = str(api.properties['patchset']) 219 properties['patchset'] = str(api.properties['patchset'])
211 properties['rietveld'] = api.properties['rietveld'] 220 properties['rietveld'] = api.properties['rietveld']
212 221
213 extra_args = [ 222 extra_args = [
214 '--workdir', '../../..', 223 '--workdir', '../../..',
215 'swarm_%s' % task_name, 224 recipe_name or 'swarm_%s' % task_name,
216 ] 225 ]
217 for k, v in properties.iteritems(): 226 for k, v in properties.iteritems():
218 extra_args.append('%s=%s' % (k, v)) 227 extra_args.append('%s=%s' % (k, v))
219 228
220 isolate_base_dir = api.path['slave_build'] 229 isolate_base_dir = api.path['slave_build']
221 dimensions = swarm_dimensions(builder_cfg) 230 dimensions = dimensions or swarm_dimensions(builder_cfg)
222 isolate_blacklist = ['.git', 'out', '*.pyc', '.recipe_deps'] 231 isolate_blacklist = ['.git', 'out', '*.pyc', '.recipe_deps']
223 isolate_vars = { 232 isolate_vars = {
224 'WORKDIR': api.path['slave_build'], 233 'WORKDIR': api.path['slave_build'],
225 } 234 }
226 235
227 isolate_file = '%s_skia.isolate' % task_name 236 isolate_file = isolate_file or '%s_skia.isolate' % task_name
228 if 'Coverage' == builder_cfg.get('configuration'): 237 if 'Coverage' == builder_cfg.get('configuration'):
229 isolate_file = 'coverage_skia.isolate' 238 isolate_file = 'coverage_skia.isolate'
230 if 'RecreateSKPs' in builder: 239 if 'RecreateSKPs' in builder:
231 isolate_file = 'compile_skia.isolate' 240 isolate_file = 'compile_skia.isolate'
232 return api.swarming.isolate_and_trigger_task( 241 return api.swarming.isolate_and_trigger_task(
233 infrabots_dir.join(isolate_file), 242 infrabots_dir.join(isolate_file),
234 isolate_base_dir, 243 isolate_base_dir,
235 '%s_skia' % task_name, 244 '%s_skia' % task_name,
236 isolate_vars, 245 isolate_vars,
237 dimensions, 246 dimensions,
(...skipping 222 matching lines...) Expand 10 before | Expand all | Expand 10 after
460 builder_cfg, 469 builder_cfg,
461 got_revision, 470 got_revision,
462 infrabots_dir, 471 infrabots_dir,
463 extra_isolate_hashes=extra_hashes, 472 extra_isolate_hashes=extra_hashes,
464 expiration=expiration, 473 expiration=expiration,
465 hard_timeout=hard_timeout, 474 hard_timeout=hard_timeout,
466 io_timeout=io_timeout, 475 io_timeout=io_timeout,
467 cipd_packages=cipd_packages) 476 cipd_packages=cipd_packages)
468 477
469 478
470 def perf_steps_collect(api, task, got_revision, is_trybot): 479 def perf_steps_collect(api, task, builder_cfg, got_revision, infrabots_dir):
471 """Wait for perf steps to finish and upload results.""" 480 """Wait for perf steps to finish and upload results."""
472 # Wait for nanobench to finish, download the results. 481 # Wait for nanobench to finish, download the results.
473 api.run.rmtree(task.task_output_dir) 482 api.run.rmtree(task.task_output_dir)
474 api.swarming.collect_swarming_task(task) 483 if not api.vars.upload_perf_results: # pragma: nocover
484 api.swarming.collect_swarming_task(task)
485 return
486
487 perf_hash = api.swarming.collect_swarming_task_isolate_hash(task)
475 488
476 # Upload the results. 489 # Upload the results.
477 if api.vars.upload_perf_results: 490 task = trigger_task(
478 perf_data_dir = api.path['slave_build'].join( 491 api,
479 'perfdata', api.properties['buildername'], 'data') 492 'upload_nano_results',
480 git_timestamp = api.git.get_timestamp(test_data='1408633190', 493 api.properties['buildername'],
481 infra_step=True) 494 api.properties['mastername'],
482 api.run.rmtree(perf_data_dir) 495 api.properties['slavename'],
483 api.file.makedirs('perf_dir', perf_data_dir, infra_step=True) 496 api.properties['buildnumber'],
484 src_results_file = task.task_output_dir.join( 497 builder_cfg,
485 '0', 'perfdata', api.properties['buildername'], 'data', 498 got_revision,
486 'nanobench_%s.json' % got_revision) 499 infrabots_dir,
487 dst_results_file = perf_data_dir.join( 500 idempotent=True,
488 'nanobench_%s_%s.json' % (got_revision, git_timestamp)) 501 store_output=False,
489 api.file.copy('perf_results', src_results_file, dst_results_file, 502 cipd_packages=None,
490 infra_step=True) 503 extra_isolate_hashes=[perf_hash],
504 recipe_name='upload_nano_results',
505 isolate_file='upload_nano_results.isolate',
506 dimensions=UPLOAD_DIMENSIONS)
491 507
492 gsutil_path = api.path['slave_build'].join( 508 return api.swarming.collect_swarming_task(task)
493 'skia', 'infra', 'bots', '.recipe_deps', 'depot_tools', 'gsutil.py')
494 upload_args = [api.properties['buildername'], api.properties['buildnumber'],
495 perf_data_dir, got_revision, gsutil_path]
496 if is_trybot:
497 upload_args.append(get_issue_num(api))
498 api.python(
499 'Upload perf results',
500 script=api.core.resource('upload_bench_results.py'),
501 args=upload_args,
502 cwd=api.path['checkout'],
503 infra_step=True)
504 509
505 510
506 def test_steps_trigger(api, builder_cfg, got_revision, infrabots_dir, 511 def test_steps_trigger(api, builder_cfg, got_revision, infrabots_dir,
507 extra_hashes, cipd_packages): 512 extra_hashes, cipd_packages):
508 """Trigger DM via Swarming.""" 513 """Trigger DM via Swarming."""
509 expiration, hard_timeout, io_timeout = get_timeouts(builder_cfg) 514 expiration, hard_timeout, io_timeout = get_timeouts(builder_cfg)
510 return trigger_task( 515 return trigger_task(
511 api, 516 api,
512 'test', 517 'test',
513 api.properties['buildername'], 518 api.properties['buildername'],
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
735 infrabots_dir, extra_hashes, cipd_packages) 740 infrabots_dir, extra_hashes, cipd_packages)
736 is_trybot = builder_cfg['is_trybot'] 741 is_trybot = builder_cfg['is_trybot']
737 742
738 # Wait for results, then upload them if necessary. 743 # Wait for results, then upload them if necessary.
739 744
740 if test_task: 745 if test_task:
741 test_steps_collect(api, test_task, 746 test_steps_collect(api, test_task,
742 got_revision, is_trybot, builder_cfg) 747 got_revision, is_trybot, builder_cfg)
743 748
744 if perf_task: 749 if perf_task:
745 perf_steps_collect(api, perf_task, 750 perf_steps_collect(api, perf_task, builder_cfg,
746 got_revision, is_trybot) 751 got_revision, infrabots_dir)
747 752
748 753
749 def test_for_bot(api, builder, mastername, slavename, testname=None): 754 def test_for_bot(api, builder, mastername, slavename, testname=None):
750 """Generate a test for the given bot.""" 755 """Generate a test for the given bot."""
751 testname = testname or builder 756 testname = testname or builder
752 test = ( 757 test = (
753 api.test(testname) + 758 api.test(testname) +
754 api.properties(buildername=builder, 759 api.properties(buildername=builder,
755 mastername=mastername, 760 mastername=mastername,
756 slavename=slavename, 761 slavename=slavename,
(...skipping 13 matching lines...) Expand all
770 paths.append(api.path['slave_build'].join( 775 paths.append(api.path['slave_build'].join(
771 'skia', 'infra', 'bots', 'assets', 'android_sdk', 'VERSION')) 776 'skia', 'infra', 'bots', 'assets', 'android_sdk', 'VERSION'))
772 if 'Test' in builder and 'Coverage' not in builder: 777 if 'Test' in builder and 'Coverage' not in builder:
773 test += api.step_data( 778 test += api.step_data(
774 'upload new .isolated file for test_skia', 779 'upload new .isolated file for test_skia',
775 stdout=api.raw_io.output('def456 XYZ.isolated')) 780 stdout=api.raw_io.output('def456 XYZ.isolated'))
776 if 'Perf' in builder and '-CT_' not in builder: 781 if 'Perf' in builder and '-CT_' not in builder:
777 test += api.step_data( 782 test += api.step_data(
778 'upload new .isolated file for perf_skia', 783 'upload new .isolated file for perf_skia',
779 stdout=api.raw_io.output('def456 XYZ.isolated')) 784 stdout=api.raw_io.output('def456 XYZ.isolated'))
785 test += api.step_data(
786 'upload new .isolated file for upload_nano_results_skia',
787 stdout=api.raw_io.output('def456 XYZ.isolated'))
780 if 'Housekeeper' in builder and 'RecreateSKPs' not in builder: 788 if 'Housekeeper' in builder and 'RecreateSKPs' not in builder:
781 test += api.step_data( 789 test += api.step_data(
782 'upload new .isolated file for housekeeper_skia', 790 'upload new .isolated file for housekeeper_skia',
783 stdout=api.raw_io.output('def456 XYZ.isolated')) 791 stdout=api.raw_io.output('def456 XYZ.isolated'))
784 if 'Win' in builder: 792 if 'Win' in builder:
785 paths.append(api.path['slave_build'].join( 793 paths.append(api.path['slave_build'].join(
786 'skia', 'infra', 'bots', 'assets', 'win_toolchain', 'VERSION')) 794 'skia', 'infra', 'bots', 'assets', 'win_toolchain', 'VERSION'))
787 paths.append(api.path['slave_build'].join( 795 paths.append(api.path['slave_build'].join(
788 'skia', 'infra', 'bots', 'assets', 'win_vulkan_sdk', 'VERSION')) 796 'skia', 'infra', 'bots', 'assets', 'win_vulkan_sdk', 'VERSION'))
789 paths.append(api.path['slave_build'].join( 797 paths.append(api.path['slave_build'].join(
(...skipping 27 matching lines...) Expand all
817 mastername='client.skia', 825 mastername='client.skia',
818 slavename='skiabot-linux-swarm-000', 826 slavename='skiabot-linux-swarm-000',
819 buildnumber=5, 827 buildnumber=5,
820 path_config='kitchen', 828 path_config='kitchen',
821 revision='abc123', 829 revision='abc123',
822 **gerrit_kwargs) + 830 **gerrit_kwargs) +
823 api.step_data( 831 api.step_data(
824 'upload new .isolated file for test_skia', 832 'upload new .isolated file for test_skia',
825 stdout=api.raw_io.output('def456 XYZ.isolated')) 833 stdout=api.raw_io.output('def456 XYZ.isolated'))
826 ) 834 )
OLDNEW
« no previous file with comments | « no previous file | infra/bots/recipes/swarm_trigger.expected/Perf-Ubuntu-GCC-GCE-CPU-AVX2-x86_64-Release-Trybot.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698