skia2/infra/bots/recipes/upload_calmbench_results.py
Ben Wagner a6f07c5b5c Reland "Use integer patchset and issue variables."
This is a reland of 50b1248ed8

Fixes from the original are in PS2. Change several recipes to use the
shared 'is_trybot' variable, and explicitly check for 0 rather than
relying on patch_ref not being set.

Original change's description:
> Use integer patchset and issue variables.
>
> See https://skia-review.googlesource.com/c/buildbot/+/246397/
>
> Change-Id: I39dae809abdc63007f65bc05040809d1a870b118
> Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246302
> Commit-Queue: Ben Wagner aka dogben <benjaminwagner@google.com>
> Reviewed-by: Eric Boren <borenet@google.com>

Change-Id: Ibe1d4f0dc1dc61c39eee6c980bd7509fc260101b
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/246919
Commit-Queue: Eric Boren <borenet@google.com>
Auto-Submit: Ben Wagner aka dogben <benjaminwagner@google.com>
Reviewed-by: Eric Boren <borenet@google.com>
2019-10-08 11:28:17 +00:00

100 lines
2.7 KiB
Python

# Copyright 2017 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 calmbench results.
import calendar
DEPS = [
'flavor',
'recipe_engine/context',
'recipe_engine/file',
'recipe_engine/path',
'recipe_engine/properties',
'recipe_engine/step',
'recipe_engine/time',
'run',
'vars',
]
def FindFile(api, suffix):
with api.context(cwd=api.path['start_dir']):
results = api.file.glob_paths(
'find %s results' % suffix,
api.path['start_dir'].join('perf'),
'*.%s' % suffix,
test_data=['bench_modified_master.%s' % suffix])
if len(results) != 1: # pragma: nocover
raise Exception('Unable to find the %s file!' % suffix)
return results[0]
def RunSteps(api):
api.vars.setup()
api.file.ensure_directory('makedirs tmp_dir', api.vars.tmp_dir)
api.flavor.setup()
now = api.time.utcnow()
json_src = FindFile(api, "json")
csv_src = FindFile(api, "csv")
ts = int(calendar.timegm(now.utctimetuple()))
basename = "bench_modified_master_%s_%d" % (api.properties['revision'], ts)
gs_path = '/'.join((
'calmbench-v1', str(now.year).zfill(4),
str(now.month).zfill(2), str(now.day).zfill(2), str(now.hour).zfill(2),
api.vars.builder_name))
if api.vars.is_trybot:
gs_path = '/'.join(('trybot', gs_path,
str(api.vars.issue), str(api.vars.patchset)))
dst = '/'.join((
'gs://%s' % api.properties['gs_bucket'], gs_path, basename))
json_dst = dst + ".json"
csv_dst = dst + ".csv"
api.step(
'upload json',
cmd=['gsutil', 'cp', '-z', 'json', json_src, json_dst],
infra_step=True)
api.step(
'upload csv',
cmd=['gsutil', 'cp', '-z', 'csv', csv_src, csv_dst],
infra_step=True)
def GenTests(api):
builder = 'Calmbench-Debian9-Clang-GCE-CPU-AVX2-x86_64-Release-All'
yield (
api.test('normal_bot') +
api.properties(buildername=builder,
repository='https://skia.googlesource.com/skia.git',
gs_bucket='skia-calmbench',
swarm_out_dir='[SWARM_OUT_DIR]',
revision='abc123',
path_config='kitchen')
)
yield (
api.test('trybot') +
api.properties.tryserver(
gerrit_project='skia',
gerrit_url='https://skia-review.googlesource.com/',
) +
api.properties(buildername=builder,
repository='https://skia.googlesource.com/skia.git',
gs_bucket='skia-calmbench',
swarm_out_dir='[SWARM_OUT_DIR]',
revision='abc123',
path_config='kitchen')
)