Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 #!/usr/bin/env python | |
| 2 # Copyright (c) 2015 The Chromium Authors. All rights reserved. | |
| 3 # Use of this source code is governed by a BSD-style license that can be | |
| 4 # found in the LICENSE file. | |
| 5 | |
| 6 """This script is meant to be run on a Swarming slave.""" | |
| 7 | |
| 8 import optparse | |
|
nednguyen
2015/11/13 18:24:39
Let's use argparse :-)
rmistry
2015/11/16 16:31:49
Done.
| |
| 9 import os | |
| 10 import path_util | |
| 11 import shutil | |
| 12 import stat | |
| 13 import subprocess | |
| 14 import sys | |
| 15 | |
| 16 path_util.AddDirToPathIfNeeded( | |
| 17 path_util.GetChromiumSrcDir(), 'tools', 'telemetry') | |
| 18 from catapult_base import cloud_storage | |
| 19 | |
| 20 | |
| 21 CT_BINARY = 'run_chromium_perf_swarming' | |
| 22 CT_BUCKET = 'cluster-telemetry' | |
| 23 PARENT_DIR = os.path.dirname(os.path.realpath(__file__)) | |
| 24 | |
| 25 | |
| 26 def main(): | |
| 27 parser = optparse.OptionParser() | |
| 28 parser.add_option('-s', '--slave_num', help='The slave num of this CT run.') | |
| 29 parser.add_option('-b', '--benchmark', help='The benchmark to run.') | |
| 30 parser.add_option('-m', '--master', | |
| 31 help='The master the builder is running on.') | |
| 32 parser.add_option('-c', '--builder', | |
| 33 help='The builder that triggered this run.') | |
| 34 parser.add_option('-g', '--git_hash', | |
| 35 help='The git hash the build was triggered at.') | |
| 36 | |
| 37 (options, args) = parser.parse_args() | |
| 38 | |
| 39 ct_binary_path = os.path.join(PARENT_DIR, CT_BINARY) | |
| 40 chromium_binary_path = os.path.join( | |
| 41 path_util.GetChromiumSrcDir(), 'out', 'Release') | |
| 42 page_sets_dir = os.path.join( | |
| 43 PARENT_DIR, 'slave%s' % options.slave_num, 'page_sets') | |
| 44 telemetry_binaries_dir = os.path.join( | |
| 45 path_util.GetChromiumSrcDir(), 'tools', 'perf') | |
| 46 | |
| 47 # Move wpr archives to the telemetry data dir. | |
| 48 ct_data_dir = os.path.join(page_sets_dir, 'data') | |
| 49 telemetry_data_dir = os.path.join(telemetry_binaries_dir, 'page_sets', 'data') | |
| 50 for wpr in os.listdir(ct_data_dir): | |
| 51 shutil.move(os.path.join(ct_data_dir, wpr), telemetry_data_dir) | |
|
nednguyen
2015/11/13 18:24:39
I think it's better for ct page sets to know how t
rmistry
2015/11/16 16:31:49
Agreed, this was a temporary hack I forgot to upda
| |
| 52 | |
| 53 # Set executable bit on the binary. | |
| 54 os.chmod(ct_binary_path, os.stat(ct_binary_path).st_mode | stat.S_IEXEC) | |
| 55 | |
| 56 # Run Cluster Telemetry. | |
| 57 cmd = [ | |
| 58 ct_binary_path, | |
| 59 '--worker_num', options.slave_num, | |
| 60 '--chromium_build', chromium_binary_path, | |
| 61 '--benchmark_name', options.benchmark, | |
| 62 '--telemetry_binaries_dir', telemetry_binaries_dir, | |
| 63 '--page_sets_dir', page_sets_dir, | |
| 64 '--master', options.master, | |
| 65 '--builder', options.builder, | |
| 66 '--git_hash', options.git_hash, | |
| 67 '--alsologtostderr', | |
| 68 ] | |
| 69 subprocess.call(cmd) | |
| 70 | |
| 71 | |
| 72 if __name__ == '__main__': | |
| 73 sys.exit(main()) | |
| OLD | NEW |