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

Unified Diff: scripts/slave/recipes/perf/ct_top1k_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: Fix indentation in slaves.cfg 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 side-by-side diff with in-line comments
Download patch
Index: scripts/slave/recipes/perf/ct_top1k_perf.py
diff --git a/scripts/slave/recipes/perf/ct_top1k_perf.py b/scripts/slave/recipes/perf/ct_top1k_perf.py
new file mode 100644
index 0000000000000000000000000000000000000000..fa591aef7db6dfedb0a323afb49d16e601e76cb7
--- /dev/null
+++ b/scripts/slave/recipes/perf/ct_top1k_perf.py
@@ -0,0 +1,151 @@
+# Copyright 2015 The Chromium Authors. All rights reserved.
+# Use of this source code is governed by a BSD-style license that can be
+# found in the LICENSE file.
+
+
+DEPS = [
+ 'archive',
+ 'ct_swarming',
+ 'file',
+ 'path',
+ 'properties',
+ 'step',
+ 'time',
+]
+
+
+CT_PAGE_TYPE = '1k'
+CT_BINARY = 'run_chromium_perf_swarming'
+CT_ISOLATE = 'ct_top1k.isolate'
+
+# Number of slaves to shard CT runs to.
+DEFAULT_CT_NUM_SLAVES = 100
+
+
+def _DownloadAndExtractBinary(api):
+ """Downloads the binary from the revision passed to the recipe."""
+ api.archive.download_and_unzip_build(
+ step_name='Download and Extract Binary',
+ target='Release',
+ build_url=None, # This is a required parameter, but has no effect.
+ build_archive_url=api.properties['parent_build_archive_url'])
+
+
+def RunSteps(api):
+ # Figure out which benchmark to use.
+ buildername = api.properties['buildername']
+ if 'Repaint' in buildername:
+ benchmark = 'repaint'
+ elif 'RR' in buildername:
+ benchmark = 'rasterize_and_record_micro'
+ else:
+ raise Exception('Do not recognise the buildername %s.' % buildername)
+
+ # Checkout chromium and swarming.
+ api.ct_swarming.checkout_dependencies()
+
+ # Download the prebuilt chromium binary.
+ _DownloadAndExtractBinary(api)
+
+ # Download Cluster Telemetry binary.
+ api.ct_swarming.download_CT_binary(CT_BINARY)
+
+ # Record how long the step took in swarming tasks.
+ swarming_start_time = api.time.time()
+
+ ct_num_slaves = api.properties.get('ct_num_slaves', DEFAULT_CT_NUM_SLAVES)
+ for slave_num in range(1, ct_num_slaves + 1):
+ # Download page sets and archives.
+ api.ct_swarming.download_page_artifacts(CT_PAGE_TYPE, slave_num)
+
+ # Create this slave's isolated.gen.json file to use for batcharchiving.
+ isolate_dir = api.path['checkout'].join('chrome')
+ isolate_path = isolate_dir.join(CT_ISOLATE)
+ extra_variables = {
+ 'SLAVE_NUM': str(slave_num),
+ 'MASTER': api.properties['mastername'],
+ 'BUILDER': api.properties['buildername'],
+ 'GIT_HASH': api.properties['git_revision'],
+ 'BENCHMARK': benchmark,
+ }
+ api.ct_swarming.create_isolated_gen_json(
+ isolate_path, isolate_dir, 'linux', slave_num, extra_variables)
+
+ # Batcharchive everything on the isolate server for efficiency.
+ api.ct_swarming.batcharchive(ct_num_slaves)
+ swarm_hashes = (
+ api.step.active_result.presentation.properties['swarm_hashes']).values()
+
+ # Trigger all swarming tasks.
+ tasks = api.ct_swarming.trigger_swarming_tasks(
+ swarm_hashes, task_name_prefix='ct-1k-task',
+ dimensions={'os': 'Ubuntu', 'gpu': '10de'})
+
+ # Now collect all tasks.
+ api.ct_swarming.collect_swarming_tasks(tasks)
+
+ print ('Running isolating, triggering and collecting swarming tasks took a '
+ 'total of %s seconds') % (api.time.time() - swarming_start_time)
+
+
+def GenTests(api):
+ mastername = 'chromium.perf.fyi'
+ slavename = 'test-slave'
+ parent_build_archive_url = 'http:/dummy-url.com'
+ parent_got_swarming_client_revision = '12345'
+ git_revision = 'xy12z43'
+ ct_num_slaves = 5
+
+ yield(
+ api.test('CT_Top1k_RR') +
+ api.properties(
+ buildername='Linux CT Top1k RR Perf',
+ mastername=mastername,
+ slavename=slavename,
+ parent_build_archive_url=parent_build_archive_url,
+ parent_got_swarming_client_revision=parent_got_swarming_client_revision,
+ git_revision=git_revision,
+ ct_num_slaves=ct_num_slaves,
+ )
+ )
+
+ yield(
+ api.test('CT_Top1k_Repaint') +
+ api.properties(
+ buildername='Linux CT Top1k Repaint Perf',
+ mastername=mastername,
+ slavename=slavename,
+ parent_build_archive_url=parent_build_archive_url,
+ parent_got_swarming_client_revision=parent_got_swarming_client_revision,
+ git_revision=git_revision,
+ ct_num_slaves=ct_num_slaves,
+ )
+ )
+
+ yield(
+ api.test('CT_Top1k_Unsupported') +
+ api.properties(
+ buildername='Linux CT Top1k Unsupported Perf',
+ mastername=mastername,
+ slavename=slavename,
+ parent_build_archive_url=parent_build_archive_url,
+ parent_got_swarming_client_revision=parent_got_swarming_client_revision,
+ git_revision=git_revision,
+ ct_num_slaves=ct_num_slaves,
+ ) +
+ api.expect_exception('Exception')
+ )
+
+ yield(
+ api.test('CT_Top1k_slave3_failure') +
+ api.step_data('ct-1k-task-3 on Ubuntu', retcode=1) +
+ api.properties(
+ buildername='Linux CT Top1k RR Perf',
+ mastername=mastername,
+ slavename=slavename,
+ parent_build_archive_url=parent_build_archive_url,
+ parent_got_swarming_client_revision=parent_got_swarming_client_revision,
+ git_revision=git_revision,
+ ct_num_slaves=ct_num_slaves,
+ )
+ )
« no previous file with comments | « scripts/slave/recipe_modules/ct_swarming/api.py ('k') | scripts/slave/recipes/perf/ct_top1k_perf.expected/CT_Top1k_RR.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698