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

Side by Side Diff: scripts/slave/recipes/perf/ct_top1k_rr_perf.py

Issue 1423993007: CT Perf recipe to run benchmarks on the top 1k sites using swarming (Closed) Base URL: https://chromium.googlesource.com/chromium/tools/build@master
Patch Set: Extract reusable functionality into recipe modules Created 5 years, 1 month 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
OLDNEW
(Empty)
1 # Copyright 2015 The Chromium Authors. All rights reserved.
2 # Use of this source code is governed by a BSD-style license that can be
3 # found in the LICENSE file.
4
5
6 DEPS = [
7 'archive',
8 'ct_swarming',
9 'file',
10 'properties',
11 'time',
12 ]
13
14
15 CT_PAGE_TYPE = '1k'
16 CT_BINARY = 'run_chromium_perf_swarming'
17 CT_ISOLATE_TEMPLATE = 'ct_top1k.isolate.tmpl'
18
19 # Number of slaves to shard CT runs to.
20 # TODO(rmistry): Change the below to 100 when ready to run the full top 1k.
21 CT_NUM_SLAVES = 2
22
23
24 def _DownloadAndExtractBinary(api):
25 """Downloads the binary from the revision passed to the recipe."""
26 api.archive.download_and_unzip_build(
27 step_name='Download and Extract Binary',
28 target='Release',
29 build_url=None, # This is a required parameter, but has no effect.
30 build_archive_url=api.properties['parent_build_archive_url'])
31
32
33 def RunSteps(api):
34 # Figure out which benchmark to use.
35 buildername = api.properties['buildername']
36 if 'Repaint' in buildername:
37 benchmark = 'repaint'
38 elif 'RR' in buildername:
39 benchmark = 'rasterize_and_record_micro'
40 else:
41 raise Exception('Do not recognise the buildername %s.' % buildername)
42
43 # Checkout chromium and swarming.
44 api.ct_swarming.checkout_dependencies()
45
46 # Download the prebuilt chromium binary.
47 _DownloadAndExtractBinary(api)
48
49 # Download Cluster Telemetry binary.
50 api.ct_swarming.download_CT_binary(CT_BINARY)
51
52 # List that will contain all .isolated.gen.json file locations.
53 isolated_gen_json_files = []
54
55 # Record how long the step took in swarming tasks.
56 swarming_start_time = api.time.time()
57
58 for slave_num in range(1, CT_NUM_SLAVES + 1):
59 slave_dir = api.ct_swarming.downloads_dir.join('slave%s' % slave_num)
60
61 # Download page sets and archives.
62 api.ct_swarming.download_page_artifacts(CT_PAGE_TYPE, slave_num, slave_dir)
63
64 # TODO(rmistry): Remove the entire below section after crrev.com/1410353007
65 # is submitted.
66 api.file.copy(
67 'copy %s' % CT_ISOLATE_TEMPLATE,
68 '/repos/chromium/src/chrome/%s' % CT_ISOLATE_TEMPLATE,
69 api.ct_swarming.chromium_src_dir.join('chrome', CT_ISOLATE_TEMPLATE))
70 for f in ['run_ct_top1k.py', 'path_util.py']:
71 api.file.copy(
72 'copy %s' % f,
73 '/repos/chromium/src/content/test/ct/%s' % f,
74 api.ct_swarming.chromium_src_dir.join('content', 'test', 'ct', f))
75
76 # Create this slave's isolate file from the CT_ISOLATE_TEMPLATE.
77 isolate_dir = api.ct_swarming.chromium_src_dir.join('chrome')
78 isolate_template_path = isolate_dir.join(CT_ISOLATE_TEMPLATE)
79 generated_isolate_path = isolate_dir.join(
80 'slave%s.ct_top1k.isolate' % slave_num)
81 with open(str(generated_isolate_path), 'wb') as fout:
82 with open(str(isolate_template_path), 'rb') as fin:
83 for line in fin:
84 fout.write(line.replace('[[SLAVE_NUM]]', str(slave_num))
85 .replace('[[MASTER]]', api.properties['mastername'])
86 .replace('[[BUILDER]]', api.properties['buildername'])
87 .replace('[[GIT_HASH]]',
88 api.properties['git_revision'])
89 .replace('[[BENCHMARK]]', benchmark))
90
91 # Create the slave's isolated.gen.json file to use for batcharchiving.
92 isolated_gen_json_files.append(
93 api.ct_swarming.create_isolated_gen_json(
94 generated_isolate_path, isolate_dir, 'linux', slave_num))
95
96 # Batcharchive everything on the isolate server for efficiency.
97 api.ct_swarming.batcharchive(isolated_gen_json_files)
98
99 # Trigger all swarming tasks.
100 for slave_num in range(1, CT_NUM_SLAVES + 1):
101 api.ct_swarming.trigger_swarming_task(
102 'ct-1k-task-%s' % slave_num, slave_num,
103 dimensions=['os Ubuntu', 'gpu 10de'])
104
105 # Now collect all tasks.
106 for slave_num in range(1, CT_NUM_SLAVES + 1):
107 api.ct_swarming.collect_swarming_task(slave_num)
108
109 api.ct_swarming.cleanup()
110
111 print ('Running isolating, triggering and collecting swarming tasks took a '
112 'total of %s seconds') % (api.time.time() - swarming_start_time)
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698