Chromium Code Reviews| 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 'properties', | |
| 11 'step', | |
| 12 'time', | |
| 13 ] | |
| 14 | |
| 15 | |
| 16 CT_PAGE_TYPE = '1k' | |
| 17 CT_BINARY = 'run_chromium_perf_swarming' | |
| 18 CT_ISOLATE_TEMPLATE = 'ct_top1k.isolate.tmpl' | |
| 19 | |
| 20 # Number of slaves to shard CT runs to. | |
| 21 # TODO(rmistry): Change the below to 100 when ready to run the full top 1k. | |
| 22 CT_NUM_SLAVES = 2 | |
| 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 for slave_num in range(1, CT_NUM_SLAVES + 1): | |
| 57 slave_dir = api.ct_swarming.downloads_dir.join('slave%s' % slave_num) | |
| 58 | |
| 59 # Download page sets and archives. | |
| 60 api.ct_swarming.download_page_artifacts(CT_PAGE_TYPE, slave_num, slave_dir) | |
|
M-A Ruel
2015/11/12 17:33:41
IMHO You shouldn't pass an arbitrary path, the pat
rmistry
2015/11/13 14:59:58
Done. Not returning the path because the downloads
| |
| 61 | |
| 62 # TODO(rmistry): Remove the entire below section after crrev.com/1410353007 | |
| 63 # is submitted. | |
| 64 api.file.copy( | |
| 65 'copy %s' % CT_ISOLATE_TEMPLATE, | |
| 66 '/repos/chromium/src/chrome/%s' % CT_ISOLATE_TEMPLATE, | |
| 67 api.ct_swarming.chromium_src_dir.join('chrome', CT_ISOLATE_TEMPLATE)) | |
| 68 for f in ['run_ct_top1k.py', 'path_util.py']: | |
| 69 api.file.copy( | |
| 70 'copy %s' % f, | |
| 71 '/repos/chromium/src/content/test/ct/%s' % f, | |
| 72 api.ct_swarming.chromium_src_dir.join('content', 'test', 'ct', f)) | |
| 73 | |
| 74 # Create this slave's isolate file from the CT_ISOLATE_TEMPLATE. | |
| 75 isolate_dir = api.ct_swarming.chromium_src_dir.join('chrome') | |
| 76 isolate_template_path = isolate_dir.join(CT_ISOLATE_TEMPLATE) | |
| 77 generated_isolate_path = isolate_dir.join( | |
| 78 'slave%s.ct_top1k.isolate' % slave_num) | |
| 79 with open(str(generated_isolate_path), 'wb') as fout: | |
| 80 with open(str(isolate_template_path), 'rb') as fin: | |
| 81 for line in fin: | |
| 82 fout.write(line.replace('[[SLAVE_NUM]]', str(slave_num)) | |
| 83 .replace('[[MASTER]]', api.properties['mastername']) | |
| 84 .replace('[[BUILDER]]', api.properties['buildername']) | |
| 85 .replace('[[GIT_HASH]]', | |
| 86 api.properties['git_revision']) | |
| 87 .replace('[[BENCHMARK]]', benchmark)) | |
| 88 | |
| 89 # Create the slave's isolated.gen.json file to use for batcharchiving. | |
| 90 api.ct_swarming.create_isolated_gen_json( | |
| 91 generated_isolate_path, isolate_dir, 'linux', slave_num) | |
| 92 | |
| 93 # Batcharchive everything on the isolate server for efficiency. | |
| 94 api.ct_swarming.batcharchive(CT_NUM_SLAVES) | |
| 95 swarm_hashes = ( | |
| 96 api.step.active_result.presentation.properties['swarm_hashes']).values() | |
| 97 | |
| 98 # Trigger all swarming tasks. | |
| 99 api.ct_swarming.trigger_swarming_tasks( | |
| 100 swarm_hashes, task_name_prefix='ct-1k-task', | |
| 101 dimensions={'os': 'Ubuntu', 'gpu': '10de'}) | |
| 102 | |
| 103 # Now collect all tasks. | |
| 104 api.ct_swarming.collect_swarming_tasks() | |
| 105 | |
| 106 api.ct_swarming.cleanup() | |
| 107 | |
| 108 print ('Running isolating, triggering and collecting swarming tasks took a ' | |
| 109 'total of %s seconds') % (api.time.time() - swarming_start_time) | |
| OLD | NEW |