2017-02-02 14:02:37 +00:00
|
|
|
# Copyright 2016 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.
|
|
|
|
|
|
|
|
|
|
|
|
# Recipe for uploading nanobench results.
|
|
|
|
|
|
|
|
|
|
|
|
from recipe_engine import recipe_api
|
|
|
|
|
|
|
|
|
|
|
|
class UploadNanoResultsApi(recipe_api.RecipeApi):
|
|
|
|
def run(self):
|
|
|
|
# Upload the nanobench resuls.
|
|
|
|
builder_name = self.m.properties['buildername']
|
|
|
|
|
|
|
|
now = self.m.time.utcnow()
|
|
|
|
src_path = self.m.path['start_dir'].join(
|
|
|
|
'perfdata', builder_name, 'data')
|
2017-02-21 12:22:20 +00:00
|
|
|
with self.m.step.context({'cwd': src_path}):
|
|
|
|
results = self.m.file.glob(
|
|
|
|
'find results',
|
|
|
|
src_path.join('*.json'),
|
|
|
|
test_data=[src_path.join('nanobench_abc123.json')],
|
|
|
|
infra_step=True)
|
2017-02-02 14:02:37 +00:00
|
|
|
if len(results) != 1: # pragma: nocover
|
|
|
|
raise Exception('Unable to find nanobench or skpbench JSON file!')
|
|
|
|
|
2017-02-21 12:22:20 +00:00
|
|
|
src = results[0]
|
2017-02-02 14:02:37 +00:00
|
|
|
basename = self.m.path.basename(src)
|
|
|
|
gs_path = '/'.join((
|
|
|
|
'nano-json-v1', str(now.year).zfill(4),
|
|
|
|
str(now.month).zfill(2), str(now.day).zfill(2), str(now.hour).zfill(2),
|
|
|
|
builder_name))
|
|
|
|
|
|
|
|
issue = str(self.m.properties.get('issue', ''))
|
|
|
|
patchset = str(self.m.properties.get('patchset', ''))
|
|
|
|
if self.m.properties.get('patch_storage', '') == 'gerrit':
|
|
|
|
issue = str(self.m.properties['patch_issue'])
|
|
|
|
patchset = str(self.m.properties['patch_set'])
|
|
|
|
if issue and patchset:
|
|
|
|
gs_path = '/'.join(('trybot', gs_path, issue, patchset))
|
|
|
|
|
2017-02-06 20:38:41 +00:00
|
|
|
dst = '/'.join((
|
|
|
|
'gs://%s' % self.m.properties['gs_bucket'], gs_path, basename))
|
2017-02-02 14:02:37 +00:00
|
|
|
|
|
|
|
self.m.step(
|
|
|
|
'upload',
|
2017-02-07 17:56:57 +00:00
|
|
|
cmd=['gsutil', 'cp', '-z', 'json', src, dst],
|
2017-02-02 14:02:37 +00:00
|
|
|
infra_step=True)
|