Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(229)

Side by Side Diff: scripts/slave/chromium/archive_profiling_data.py

Issue 10834044: Script to archive profiling data collected from (Closed) Base URL: svn://chrome-svn/chrome/trunk/tools/build/
Patch Set: Created 8 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | scripts/slave/runtest.py » ('j') | scripts/slave/runtest.py » ('J')
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:executable
## -0,0 +1 ##
+*
Added: svn:eol-style
## -0,0 +1 ##
+LF
OLDNEW
(Empty)
1 #!/usr/bin/env python
2 # Copyright (c) 2012 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 """A tool to archive Chrome profiling data generated by perf buildbots.
7
8 Pushes generated profiling data to Google Storage.
9
10 For a list of command-line options, call this script with '--help'.
11 """
12
13
14 import optparse
15 import os
16 import re
17 import subprocess
18 import sys
19
20 from slave import slave_utils
21
22 FILENAME = 'task_profile.json'
23 GOOGLE_STORAGE_BUCKET = 'chromium-browser-profiling-data'
24
25
26 def CopyToGoogleStorage(src, dst):
27 """Copies a file to the given Google Storage destination url.
28
29 Args:
30 src: path to file to be copied
31 dst: Google Storage destination url (i.e., gs://...)
32 Returns:
33 whether the copy was successful
34 """
35 if not os.path.exists(src):
36 print 'No such file', src
37 return False
38 return slave_utils.GSUtilCopy(src, dst, None, 'public-read')
39
40
41 def Archive(run_id, profiling_data_dir):
42 """Archive the profiling data to Google Storage.
43
44 Args:
45 run_id: the unique identifier of this run
46 profiling_data_dir: the path to the profiling data directory
47 Returns:
48 whether profiling data correctly uploaded or not
49 """
50 if not os.path.exists(profiling_data_dir):
51 print 'No data directory'
52 return True
53
54 profiling_file = os.path.join(profiling_data_dir, FILENAME)
55 if not os.path.exists(profiling_file):
56 print 'No profiling data file'
57 return True
58
59 run_id = re.sub('\W+', '_', run_id)
60
61 view_url = 'http://%s.commondatastorage.googleapis.com/' \
62 'view_test_results.html?%s' % (GOOGLE_STORAGE_BUCKET, run_id)
63 print 'See %s for this run\'s test results' % view_url
64 run_url = 'gs://%s/runs/%s/' % (GOOGLE_STORAGE_BUCKET, run_id)
65 print 'Pushing results to %s...' % run_url
66
67 if not CopyToGoogleStorage(profiling_file, run_url + FILENAME):
68 return False
69 return True
70
71
72 def main():
73 option_parser = optparse.OptionParser()
74 option_parser.add_option('', '--run-id', default=None,
75 help='unique id for this run')
76 option_parser.add_option('', '--profiling-data-dir', default=None,
77 help=('path to the directory holding the profiling'
78 'data'))
79 # --sw-profiling-data-dir is ignored. We keep it here so we don't have to
80 # modify master side script.
81 option_parser.add_option('', '--sw-profiling-data-dir', default=None,
82 help=('path to the directory holding the profiling'
83 'data generated by the software renderer'))
84 options = option_parser.parse_args()[0]
85 if (options.run_id is None or options.profiling_data_dir is None):
86 print 'All command options are required. Use --help.'
87 return 1
88
89 if Archive(options.run_id, options.profiling_data_dir):
90 return 0
91 return 2
92
93
94 if '__main__' == __name__:
95 sys.exit(main())
OLDNEW
« no previous file with comments | « no previous file | scripts/slave/runtest.py » ('j') | scripts/slave/runtest.py » ('J')

Powered by Google App Engine
This is Rietveld 408576698