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 argparse | |
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 = argparse.ArgumentParser() | |
28 parser.add_argument('-s', '--slave_num', required=True, | |
29 help='The slave num of this CT run.') | |
30 parser.add_argument('-b', '--benchmark', required=True, | |
31 help='The benchmark to run.') | |
32 parser.add_argument('-m', '--master', required=True, | |
33 help='The master the builder is running on.') | |
34 parser.add_argument('-c', '--builder', required=True, | |
35 help='The builder that triggered this run.') | |
36 parser.add_argument('-g', '--git_hash', required=True, | |
37 help='The git hash the build was triggered at.') | |
38 | |
39 args = parser.parse_args() | |
40 | |
41 ct_binary_path = os.path.join(PARENT_DIR, CT_BINARY) | |
42 chromium_binary_path = os.path.join( | |
43 path_util.GetChromiumSrcDir(), 'out', 'Release') | |
44 page_sets_dir = os.path.join( | |
45 PARENT_DIR, 'slave%s' % args.slave_num, 'page_sets') | |
46 telemetry_binaries_dir = os.path.join( | |
47 path_util.GetChromiumSrcDir(), 'tools', 'perf') | |
48 | |
49 # Set executable bit on the binary. | |
50 os.chmod(ct_binary_path, os.stat(ct_binary_path).st_mode | stat.S_IEXEC) | |
51 | |
52 # Run Cluster Telemetry. | |
53 cmd = [ | |
54 ct_binary_path, | |
55 '--worker_num', args.slave_num, | |
56 '--chromium_build', chromium_binary_path, | |
57 '--benchmark_name', args.benchmark, | |
58 '--telemetry_binaries_dir', telemetry_binaries_dir, | |
59 '--page_sets_dir', page_sets_dir, | |
60 '--master', args.master, | |
61 '--builder', args.builder, | |
62 '--git_hash', args.git_hash, | |
63 '--alsologtostderr', | |
64 ] | |
65 subprocess.call(cmd) | |
M-A Ruel
2015/11/16 20:22:02
return subprocess.call(cmd)
otherwise you silently
rmistry
2015/11/17 15:57:46
Done.
| |
66 | |
67 | |
68 if __name__ == '__main__': | |
69 sys.exit(main()) | |
OLD | NEW |