| OLD | NEW |
| (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 'path', |
| 11 'properties', |
| 12 'step', |
| 13 'time', |
| 14 ] |
| 15 |
| 16 |
| 17 CT_PAGE_TYPE = '1k' |
| 18 CT_BINARY = 'run_chromium_perf_swarming' |
| 19 CT_ISOLATE = 'ct_top1k.isolate' |
| 20 |
| 21 # Number of slaves to shard CT runs to. |
| 22 DEFAULT_CT_NUM_SLAVES = 100 |
| 23 |
| 24 |
| 25 def _DownloadAndExtractBinary(api): |
| 26 """Downloads the binary from the revision passed to the recipe.""" |
| 27 api.archive.download_and_unzip_build( |
| 28 step_name='Download and Extract Binary', |
| 29 target='Release', |
| 30 build_url=None, # This is a required parameter, but has no effect. |
| 31 build_archive_url=api.properties['parent_build_archive_url']) |
| 32 |
| 33 |
| 34 def RunSteps(api): |
| 35 # Figure out which benchmark to use. |
| 36 buildername = api.properties['buildername'] |
| 37 if 'Repaint' in buildername: |
| 38 benchmark = 'repaint' |
| 39 elif 'RR' in buildername: |
| 40 benchmark = 'rasterize_and_record_micro' |
| 41 else: |
| 42 raise Exception('Do not recognise the buildername %s.' % buildername) |
| 43 |
| 44 # Checkout chromium and swarming. |
| 45 api.ct_swarming.checkout_dependencies() |
| 46 |
| 47 # Download the prebuilt chromium binary. |
| 48 _DownloadAndExtractBinary(api) |
| 49 |
| 50 # Download Cluster Telemetry binary. |
| 51 api.ct_swarming.download_CT_binary(CT_BINARY) |
| 52 |
| 53 # Record how long the step took in swarming tasks. |
| 54 swarming_start_time = api.time.time() |
| 55 |
| 56 ct_num_slaves = api.properties.get('ct_num_slaves', DEFAULT_CT_NUM_SLAVES) |
| 57 for slave_num in range(1, ct_num_slaves + 1): |
| 58 # Download page sets and archives. |
| 59 api.ct_swarming.download_page_artifacts(CT_PAGE_TYPE, slave_num) |
| 60 |
| 61 # Create this slave's isolated.gen.json file to use for batcharchiving. |
| 62 isolate_dir = api.path['checkout'].join('chrome') |
| 63 isolate_path = isolate_dir.join(CT_ISOLATE) |
| 64 extra_variables = { |
| 65 'SLAVE_NUM': str(slave_num), |
| 66 'MASTER': api.properties['mastername'], |
| 67 'BUILDER': api.properties['buildername'], |
| 68 'GIT_HASH': api.properties['git_revision'], |
| 69 'BENCHMARK': benchmark, |
| 70 } |
| 71 api.ct_swarming.create_isolated_gen_json( |
| 72 isolate_path, isolate_dir, 'linux', slave_num, extra_variables) |
| 73 |
| 74 # Batcharchive everything on the isolate server for efficiency. |
| 75 api.ct_swarming.batcharchive(ct_num_slaves) |
| 76 swarm_hashes = ( |
| 77 api.step.active_result.presentation.properties['swarm_hashes']).values() |
| 78 |
| 79 # Trigger all swarming tasks. |
| 80 tasks = api.ct_swarming.trigger_swarming_tasks( |
| 81 swarm_hashes, task_name_prefix='ct-1k-task', |
| 82 dimensions={'os': 'Ubuntu', 'gpu': '10de'}) |
| 83 |
| 84 # Now collect all tasks. |
| 85 api.ct_swarming.collect_swarming_tasks(tasks) |
| 86 |
| 87 print ('Running isolating, triggering and collecting swarming tasks took a ' |
| 88 'total of %s seconds') % (api.time.time() - swarming_start_time) |
| 89 |
| 90 |
| 91 def GenTests(api): |
| 92 mastername = 'chromium.perf.fyi' |
| 93 slavename = 'test-slave' |
| 94 parent_build_archive_url = 'http:/dummy-url.com' |
| 95 parent_got_swarming_client_revision = '12345' |
| 96 git_revision = 'xy12z43' |
| 97 ct_num_slaves = 5 |
| 98 |
| 99 yield( |
| 100 api.test('CT_Top1k_RR') + |
| 101 api.properties( |
| 102 buildername='Linux CT Top1k RR Perf', |
| 103 mastername=mastername, |
| 104 slavename=slavename, |
| 105 parent_build_archive_url=parent_build_archive_url, |
| 106 parent_got_swarming_client_revision=parent_got_swarming_client_revision, |
| 107 git_revision=git_revision, |
| 108 ct_num_slaves=ct_num_slaves, |
| 109 ) |
| 110 ) |
| 111 |
| 112 yield( |
| 113 api.test('CT_Top1k_Repaint') + |
| 114 api.properties( |
| 115 buildername='Linux CT Top1k Repaint Perf', |
| 116 mastername=mastername, |
| 117 slavename=slavename, |
| 118 parent_build_archive_url=parent_build_archive_url, |
| 119 parent_got_swarming_client_revision=parent_got_swarming_client_revision, |
| 120 git_revision=git_revision, |
| 121 ct_num_slaves=ct_num_slaves, |
| 122 ) |
| 123 ) |
| 124 |
| 125 yield( |
| 126 api.test('CT_Top1k_Unsupported') + |
| 127 api.properties( |
| 128 buildername='Linux CT Top1k Unsupported Perf', |
| 129 mastername=mastername, |
| 130 slavename=slavename, |
| 131 parent_build_archive_url=parent_build_archive_url, |
| 132 parent_got_swarming_client_revision=parent_got_swarming_client_revision, |
| 133 git_revision=git_revision, |
| 134 ct_num_slaves=ct_num_slaves, |
| 135 ) + |
| 136 api.expect_exception('Exception') |
| 137 ) |
| 138 |
| 139 yield( |
| 140 api.test('CT_Top1k_slave3_failure') + |
| 141 api.step_data('ct-1k-task-3 on Ubuntu', retcode=1) + |
| 142 api.properties( |
| 143 buildername='Linux CT Top1k RR Perf', |
| 144 mastername=mastername, |
| 145 slavename=slavename, |
| 146 parent_build_archive_url=parent_build_archive_url, |
| 147 parent_got_swarming_client_revision=parent_got_swarming_client_revision, |
| 148 git_revision=git_revision, |
| 149 ct_num_slaves=ct_num_slaves, |
| 150 ) |
| 151 ) |
| OLD | NEW |