Index: content/test/ct/run_ct_top1k.py |
diff --git a/content/test/ct/run_ct_top1k.py b/content/test/ct/run_ct_top1k.py |
new file mode 100644 |
index 0000000000000000000000000000000000000000..5c0b57f6b4ea2977828e45616d05858804a74db8 |
--- /dev/null |
+++ b/content/test/ct/run_ct_top1k.py |
@@ -0,0 +1,73 @@ |
+#!/usr/bin/env python |
+# Copyright (c) 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. |
+ |
+"""This script is meant to be run on a Swarming slave.""" |
+ |
+import optparse |
nednguyen
2015/11/13 18:24:39
Let's use argparse :-)
rmistry
2015/11/16 16:31:49
Done.
|
+import os |
+import path_util |
+import shutil |
+import stat |
+import subprocess |
+import sys |
+ |
+path_util.AddDirToPathIfNeeded( |
+ path_util.GetChromiumSrcDir(), 'tools', 'telemetry') |
+from catapult_base import cloud_storage |
+ |
+ |
+CT_BINARY = 'run_chromium_perf_swarming' |
+CT_BUCKET = 'cluster-telemetry' |
+PARENT_DIR = os.path.dirname(os.path.realpath(__file__)) |
+ |
+ |
+def main(): |
+ parser = optparse.OptionParser() |
+ parser.add_option('-s', '--slave_num', help='The slave num of this CT run.') |
+ parser.add_option('-b', '--benchmark', help='The benchmark to run.') |
+ parser.add_option('-m', '--master', |
+ help='The master the builder is running on.') |
+ parser.add_option('-c', '--builder', |
+ help='The builder that triggered this run.') |
+ parser.add_option('-g', '--git_hash', |
+ help='The git hash the build was triggered at.') |
+ |
+ (options, args) = parser.parse_args() |
+ |
+ ct_binary_path = os.path.join(PARENT_DIR, CT_BINARY) |
+ chromium_binary_path = os.path.join( |
+ path_util.GetChromiumSrcDir(), 'out', 'Release') |
+ page_sets_dir = os.path.join( |
+ PARENT_DIR, 'slave%s' % options.slave_num, 'page_sets') |
+ telemetry_binaries_dir = os.path.join( |
+ path_util.GetChromiumSrcDir(), 'tools', 'perf') |
+ |
+ # Move wpr archives to the telemetry data dir. |
+ ct_data_dir = os.path.join(page_sets_dir, 'data') |
+ telemetry_data_dir = os.path.join(telemetry_binaries_dir, 'page_sets', 'data') |
+ for wpr in os.listdir(ct_data_dir): |
+ 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
|
+ |
+ # Set executable bit on the binary. |
+ os.chmod(ct_binary_path, os.stat(ct_binary_path).st_mode | stat.S_IEXEC) |
+ |
+ # Run Cluster Telemetry. |
+ cmd = [ |
+ ct_binary_path, |
+ '--worker_num', options.slave_num, |
+ '--chromium_build', chromium_binary_path, |
+ '--benchmark_name', options.benchmark, |
+ '--telemetry_binaries_dir', telemetry_binaries_dir, |
+ '--page_sets_dir', page_sets_dir, |
+ '--master', options.master, |
+ '--builder', options.builder, |
+ '--git_hash', options.git_hash, |
+ '--alsologtostderr', |
+ ] |
+ subprocess.call(cmd) |
+ |
+ |
+if __name__ == '__main__': |
+ sys.exit(main()) |