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

Side by Side Diff: infra/bots/recipe_modules/skia/resources/upload_bench_results.py

Issue 2187603005: Fix Perf data upload (Closed) Base URL: https://skia.googlesource.com/skia.git@master
Patch Set: Remove uses of common.skia Created 4 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
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 # Copyright 2014 The Chromium Authors. All rights reserved. 2 # Copyright 2014 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 """ Upload benchmark performance data results. """ 6 """ Upload benchmark performance data results. """
7 7
8 import gzip 8 import gzip
9 import os 9 import os
10 import os.path 10 import os.path
11 import re 11 import re
12 import subprocess 12 import subprocess
13 import sys 13 import sys
14 import tempfile 14 import tempfile
15 15
16 from common.skia import builder_name_schema
17 from common.skia import global_constants
18 from datetime import datetime 16 from datetime import datetime
19 17
20 18
21 def _UploadJSONResults(builder_name, build_number, dest_gsbase, gs_subdir, 19 def _UploadJSONResults(builder_name, build_number, dest_gsbase, gs_subdir,
22 full_json_path, gzipped=True, gsutil_path='gsutil', 20 full_json_path, gzipped=True, gsutil_path='gsutil',
23 issue_number=None): 21 issue_number=None):
24 now = datetime.utcnow() 22 now = datetime.utcnow()
25 gs_json_path = '/'.join((str(now.year).zfill(4), str(now.month).zfill(2), 23 gs_json_path = '/'.join((str(now.year).zfill(4), str(now.month).zfill(2),
26 str(now.day).zfill(2), str(now.hour).zfill(2))) 24 str(now.day).zfill(2), str(now.hour).zfill(2)))
27 gs_dir = '/'.join((gs_subdir, gs_json_path, builder_name)) 25 gs_dir = '/'.join((gs_subdir, gs_json_path, builder_name))
28 if builder_name_schema.IsTrybot(builder_name): 26 if builder_name.endswith('-Trybot'):
29 if not issue_number: 27 if not issue_number:
30 raise Exception('issue_number build property is missing!') 28 raise Exception('issue_number build property is missing!')
31 gs_dir = '/'.join(('trybot', gs_dir, build_number, issue_number)) 29 gs_dir = '/'.join(('trybot', gs_dir, build_number, issue_number))
32 full_path_to_upload = full_json_path 30 full_path_to_upload = full_json_path
33 file_to_upload = os.path.basename(full_path_to_upload) 31 file_to_upload = os.path.basename(full_path_to_upload)
34 http_header = ['Content-Type:application/json'] 32 http_header = ['Content-Type:application/json']
35 if gzipped: 33 if gzipped:
36 http_header.append('Content-Encoding:gzip') 34 http_header.append('Content-Encoding:gzip')
37 gzipped_file = os.path.join(tempfile.gettempdir(), file_to_upload) 35 gzipped_file = os.path.join(tempfile.gettempdir(), file_to_upload)
38 # Apply gzip. 36 # Apply gzip.
(...skipping 18 matching lines...) Expand all
57 RE_FILE_SEARCH = re.compile( 55 RE_FILE_SEARCH = re.compile(
58 'nanobench_({})_[0-9]+\.json'.format(got_revision)) 56 'nanobench_({})_[0-9]+\.json'.format(got_revision))
59 nanobench_name = None 57 nanobench_name = None
60 58
61 for file_name in file_list: 59 for file_name in file_list:
62 if RE_FILE_SEARCH.search(file_name): 60 if RE_FILE_SEARCH.search(file_name):
63 nanobench_name = file_name 61 nanobench_name = file_name
64 break 62 break
65 63
66 if nanobench_name: 64 if nanobench_name:
67 dest_gsbase = 'gs://' + global_constants.GS_GM_BUCKET 65 dest_gsbase = 'gs://chromium-skia-gm/'
68 nanobench_json_file = os.path.join(perf_data_dir, 66 nanobench_json_file = os.path.join(perf_data_dir,
69 nanobench_name) 67 nanobench_name)
70 _UploadJSONResults(builder_name, build_number, dest_gsbase, 'nano-json-v1', 68 _UploadJSONResults(builder_name, build_number, dest_gsbase, 'nano-json-v1',
71 nanobench_json_file, gsutil_path=gsutil_path, 69 nanobench_json_file, gsutil_path=gsutil_path,
72 issue_number=issue_number) 70 issue_number=issue_number)
73 71
74 72
75 if __name__ == '__main__': 73 if __name__ == '__main__':
76 main(*sys.argv[1:]) 74 main(*sys.argv[1:])
77 75
OLDNEW
« no previous file with comments | « infra/bots/recipe_modules/skia/resources/run_binary_size_analysis.py ('k') | infra/bots/recipes/swarm_trigger.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698