[infra] Move logic about skps/images/etc into gen_tasks

Change-Id: I72a1d6bd489994052c942b5c8f2e36806459360c
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/276641
Commit-Queue: Eric Boren <borenet@google.com>
Reviewed-by: Kevin Lubick <kjlubick@google.com>
Reviewed-by: Ravi Mistry <rmistry@google.com>
This commit is contained in:
Eric Boren 2020-03-23 09:17:24 -04:00 committed by Skia Commit-Bot
parent f04f21a5c9
commit 59e7496d4e
8 changed files with 553 additions and 617 deletions

View File

@ -986,4 +986,19 @@ func (b *taskBuilder) dmFlags(internalHardwareLabel string) {
// Finalize the DM flags and properties.
b.recipeProp("dm_flags", marshalJson(args))
b.recipeProp("dm_properties", marshalJson(properties))
// Add properties indicating which assets the task should use.
if b.matchExtraConfig("Lottie") {
b.asset("lottie")
b.recipeProp("lotties", "true")
} else {
b.asset("skimage")
b.recipeProp("images", "true")
b.asset("skp")
b.recipeProp("skps", "true")
b.asset("svg")
b.recipeProp("svgs", "true")
}
b.recipeProp("do_upload", fmt.Sprintf("%t", b.doUpload()))
b.recipeProp("resources", "true")
}

View File

@ -258,6 +258,26 @@ func (b *taskBuilder) nanobenchFlags(doUpload bool) {
args = append(args, "--verbose")
}
// Add properties indicating which assets the task should use.
b.recipeProp("do_upload", fmt.Sprintf("%t", doUpload))
if !b.gpu() {
b.asset("skimage")
b.recipeProp("images", "true")
}
b.recipeProp("resources", "true")
if !b.os("iOS") {
b.asset("skp")
b.recipeProp("skps", "true")
}
if !b.extraConfig("Valgrind") {
b.asset("svg")
b.recipeProp("svgs", "true")
}
if b.cpu() && b.os("Android") {
// TODO(borenet): Where do these come from?
b.recipeProp("textTraces", "true")
}
// These properties are plumbed through nanobench and into Perf results.
nanoProps := map[string]string{
"gitHash": specs.PLACEHOLDER_REVISION,

View File

@ -50,78 +50,6 @@
"@@@STEP_LOG_END@SKP_VERSION@@@"
]
},
{
"cmd": [
"vpython",
"-u",
"RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
"--json-output",
"/path/to/tmp/json",
"copy",
"[START_DIR]/skia/infra/bots/assets/skimage/VERSION",
"/path/to/tmp/"
],
"infra_step": true,
"name": "Get skimage VERSION",
"~followup_annotations": [
"@@@STEP_LOG_LINE@VERSION@42@@@",
"@@@STEP_LOG_END@VERSION@@@"
]
},
{
"cmd": [
"vpython",
"-u",
"RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
"--json-output",
"/path/to/tmp/json",
"copy",
"42",
"[START_DIR]/tmp/SK_IMAGE_VERSION"
],
"infra_step": true,
"name": "write SK_IMAGE_VERSION",
"~followup_annotations": [
"@@@STEP_LOG_LINE@SK_IMAGE_VERSION@42@@@",
"@@@STEP_LOG_END@SK_IMAGE_VERSION@@@"
]
},
{
"cmd": [
"vpython",
"-u",
"RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
"--json-output",
"/path/to/tmp/json",
"copy",
"[START_DIR]/skia/infra/bots/assets/svg/VERSION",
"/path/to/tmp/"
],
"infra_step": true,
"name": "Get svg VERSION",
"~followup_annotations": [
"@@@STEP_LOG_LINE@VERSION@42@@@",
"@@@STEP_LOG_END@VERSION@@@"
]
},
{
"cmd": [
"vpython",
"-u",
"RECIPE_MODULE[recipe_engine::file]/resources/fileutil.py",
"--json-output",
"/path/to/tmp/json",
"copy",
"42",
"[START_DIR]/tmp/SVG_VERSION"
],
"infra_step": true,
"name": "write SVG_VERSION",
"~followup_annotations": [
"@@@STEP_LOG_LINE@SVG_VERSION@42@@@",
"@@@STEP_LOG_END@SVG_VERSION@@@"
]
},
{
"cmd": [
"python",

View File

@ -50,42 +50,6 @@
"@@@STEP_LOG_END@SKP_VERSION@@@"
]
},
{
"cmd": [
"vpython",
"-u",
"RECIPE_MODULE[recipe_engine::file]\\resources\\fileutil.py",
"--json-output",
"/path/to/tmp/json",
"copy",
"[START_DIR]\\skia\\infra\\bots\\assets\\skimage\\VERSION",
"/path/to/tmp/"
],
"infra_step": true,
"name": "Get skimage VERSION",
"~followup_annotations": [
"@@@STEP_LOG_LINE@VERSION@42@@@",
"@@@STEP_LOG_END@VERSION@@@"
]
},
{
"cmd": [
"vpython",
"-u",
"RECIPE_MODULE[recipe_engine::file]\\resources\\fileutil.py",
"--json-output",
"/path/to/tmp/json",
"copy",
"42",
"[START_DIR]\\tmp\\SK_IMAGE_VERSION"
],
"infra_step": true,
"name": "write SK_IMAGE_VERSION",
"~followup_annotations": [
"@@@STEP_LOG_LINE@SK_IMAGE_VERSION@42@@@",
"@@@STEP_LOG_END@SK_IMAGE_VERSION@@@"
]
},
{
"cmd": [
"vpython",

View File

@ -27,26 +27,24 @@ DEPS = [
]
def upload_perf_results(buildername):
if 'Release' not in buildername:
return False
skip_upload_bots = [
'ASAN',
'Coverage',
'MSAN',
'TSAN',
'Valgrind',
]
for s in skip_upload_bots:
if s in buildername:
return False
return True
def perf_steps(api):
"""Run Skia benchmarks."""
b = api.properties['buildername']
if upload_perf_results(b):
do_upload = api.properties.get('do_upload') == 'true'
images = api.properties.get('images') == 'true'
resources = api.properties.get('resources') == 'true'
skps = api.properties.get('skps') == 'true'
svgs = api.properties.get('svgs') == 'true'
texttraces = api.properties.get('texttraces') == 'true'
api.flavor.install(
resources=resources,
skps=skps,
images=images,
svgs=svgs,
texttraces=texttraces,
)
if do_upload:
api.flavor.create_clean_device_dir(
api.flavor.device_dirs.perf_data_dir)
@ -55,7 +53,7 @@ def perf_steps(api):
props = json.loads(api.properties['nanobench_properties'])
swarming_bot_id = api.vars.swarming_bot_id
swarming_task_id = api.vars.swarming_task_id
if upload_perf_results(b):
if do_upload:
args.append('--properties')
# Map iteration order is arbitrary; in order to maintain a consistent step
# ordering, sort by key.
@ -69,21 +67,19 @@ def perf_steps(api):
args.extend([k, v])
# Paths to required resources.
args.extend(['-i', api.flavor.device_dirs.resource_dir])
if 'iOS' not in b:
if resources:
args.extend(['-i', api.flavor.device_dirs.resource_dir])
if skps:
args.extend(['--skps', api.flavor.device_dirs.skp_dir]),
if 'GPU' not in b:
if images:
args.extend(['--images', api.flavor.device_path_join(
api.flavor.device_dirs.images_dir, 'nanobench')])
if api.vars.builder_cfg.get('cpu_or_gpu') == 'CPU' and 'Android' in b:
if texttraces:
assert api.flavor.device_dirs.texttraces_dir
args.extend(['--texttraces', api.flavor.device_dirs.texttraces_dir])
# Do not run svgs on Valgrind.
if 'Valgrind' not in b:
if svgs:
args.extend(['--svgs', api.flavor.device_dirs.svg_dir])
if upload_perf_results(b):
if do_upload:
now = api.time.utcnow()
ts = int(calendar.timegm(now.utctimetuple()))
json_path = api.flavor.device_path_join(
@ -95,7 +91,7 @@ def perf_steps(api):
abort_on_failure=False)
# Copy results to swarming out dir.
if upload_perf_results(b):
if do_upload:
api.file.ensure_directory(
'makedirs perf_dir',
api.flavor.host_dirs.perf_data_dir)
@ -110,11 +106,6 @@ def RunSteps(api):
api.flavor.setup('nanobench')
try:
if all(v in api.vars.builder_name for v in ['Android', 'CPU']):
api.flavor.install(skps=True, images=True, svgs=True, resources=True,
texttraces=True)
else:
api.flavor.install(skps=True, images=True, svgs=True, resources=True)
perf_steps(api)
finally:
api.flavor.cleanup_steps()
@ -131,16 +122,30 @@ TEST_BUILDERS = [
def GenTests(api):
for builder in TEST_BUILDERS:
props = dict(
buildername=builder,
nanobench_flags='["nanobench","--dummy","--flags"]',
nanobench_properties=('{"key1":"value1","key2":"",'
'"bot":"${SWARMING_BOT_ID}",'
'"task":"${SWARMING_TASK_ID}"}'),
path_config='kitchen',
resources='true',
revision='abc123',
swarm_out_dir='[SWARM_OUT_DIR]'
)
if 'Valgrind' not in builder and 'Debug' not in builder:
props['do_upload'] = 'true'
if 'GPU' not in builder:
props['images'] = 'true'
if 'iOS' not in builder:
props['skps'] = 'true'
if 'Valgrind' not in builder:
props['svgs'] = 'true'
if 'Android' in builder and 'CPU' in builder:
props['texttraces'] = 'true'
test = (
api.test(builder) +
api.properties(buildername=builder,
nanobench_flags='["nanobench","--dummy","--flags"]',
nanobench_properties=('{"key1":"value1","key2":"",'
'"bot":"${SWARMING_BOT_ID}",'
'"task":"${SWARMING_TASK_ID}"}'),
revision='abc123',
path_config='kitchen',
swarm_out_dir='[SWARM_OUT_DIR]') +
api.properties(**props) +
api.path.exists(
api.path['start_dir'].join('skia'),
api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',

View File

@ -171,14 +171,6 @@
"123456",
"--resourcePath",
"[START_DIR]/skia/resources",
"--skps",
"[START_DIR]/skp",
"--images",
"[START_DIR]/skimage/dm",
"--colorImages",
"[START_DIR]/skimage/colorspace",
"--svgs",
"[START_DIR]/svg",
"--lotties",
"[START_DIR]/skia/resources/skottie",
"[START_DIR]/lottie-samples",

View File

@ -25,25 +25,25 @@ DEPS = [
]
def upload_dm_results(buildername):
skip_upload_bots = [
'ASAN',
'Coverage',
'MSAN',
'TSAN',
'Valgrind',
]
for s in skip_upload_bots:
if s in buildername:
return False
return True
def test_steps(api):
"""Run the DM test."""
b = api.properties['buildername']
do_upload = api.properties.get('do_upload') == 'true'
images = api.properties.get('images') == 'true'
lotties = api.properties.get('lotties') == 'true'
resources = api.properties.get('resources') == 'true'
skps = api.properties.get('skps') == 'true'
svgs = api.properties.get('svgs') == 'true'
api.flavor.install(
images=images,
lotties=lotties,
resources=resources,
skps=skps,
svgs=svgs,
)
use_hash_file = False
if upload_dm_results(b):
if do_upload:
host_dm_dir = str(api.flavor.host_dirs.dm_dir)
api.flavor.create_clean_host_dir(api.path['start_dir'].join('test'))
device_dm_dir = str(api.flavor.device_dirs.dm_dir)
@ -115,16 +115,20 @@ def test_steps(api):
args.extend([k, v])
# Paths to required resources.
args.extend([
'--resourcePath', api.flavor.device_dirs.resource_dir,
'--skps', api.flavor.device_dirs.skp_dir,
'--images', api.flavor.device_path_join(
api.flavor.device_dirs.images_dir, 'dm'),
'--colorImages', api.flavor.device_path_join(
api.flavor.device_dirs.images_dir, 'colorspace'),
'--svgs', api.flavor.device_dirs.svg_dir,
])
if 'Lottie' in api.vars.builder_cfg.get('extra_config', ''):
if resources:
args.extend(['--resourcePath', api.flavor.device_dirs.resource_dir])
if skps:
args.extend(['--skps', api.flavor.device_dirs.skp_dir])
if images:
args.extend([
'--images', api.flavor.device_path_join(
api.flavor.device_dirs.images_dir, 'dm'),
'--colorImages', api.flavor.device_path_join(
api.flavor.device_dirs.images_dir, 'colorspace'),
])
if svgs:
args.extend(['--svgs', api.flavor.device_dirs.svg_dir])
if lotties:
args.extend([
'--lotties',
api.flavor.device_path_join(
@ -134,13 +138,13 @@ def test_steps(api):
if use_hash_file:
args.extend(['--uninterestingHashesFile', hashes_file])
if upload_dm_results(b):
if do_upload:
args.extend(['--writePath', api.flavor.device_dirs.dm_dir])
# Run DM.
api.run(api.flavor.step, 'dm', cmd=args, abort_on_failure=False)
if upload_dm_results(b):
if do_upload:
# Copy images and JSON to host machine if needed.
api.flavor.copy_directory_contents_to_host(
api.flavor.device_dirs.dm_dir, api.flavor.host_dirs.dm_dir)
@ -152,10 +156,6 @@ def RunSteps(api):
api.flavor.setup('dm')
try:
if 'Lottie' in api.vars.builder_name:
api.flavor.install(resources=True, lotties=True)
else:
api.flavor.install(skps=True, images=True, svgs=True, resources=True)
test_steps(api)
finally:
api.flavor.cleanup_steps()
@ -172,19 +172,31 @@ TEST_BUILDERS = [
def GenTests(api):
for builder in TEST_BUILDERS:
props = dict(
buildername=builder,
buildbucket_build_id='123454321',
dm_flags='["dm","--dummy","--flags"]',
dm_properties=('{"key1":"value1","key2":"",'
'"bot":"${SWARMING_BOT_ID}",'
'"task":"${SWARMING_TASK_ID}"}'),
revision='abc123',
path_config='kitchen',
gold_hashes_url='https://example.com/hashes.txt',
swarm_out_dir='[SWARM_OUT_DIR]',
task_id='task_12345',
resources='true',
)
if 'ASAN' not in builder:
props['do_upload'] = 'true'
if 'Lottie' in builder:
props['lotties'] = 'true'
else:
props['images'] = 'true'
props['skps'] = 'true'
props['svgs'] = 'true'
test = (
api.test(builder) +
api.properties(buildername=builder,
buildbucket_build_id='123454321',
dm_flags='["dm","--dummy","--flags"]',
dm_properties=('{"key1":"value1","key2":"",'
'"bot":"${SWARMING_BOT_ID}",'
'"task":"${SWARMING_TASK_ID}"}'),
revision='abc123',
path_config='kitchen',
gold_hashes_url='https://example.com/hashes.txt',
swarm_out_dir='[SWARM_OUT_DIR]',
task_id='task_12345') +
api.properties(**props) +
api.path.exists(
api.path['start_dir'].join('skia'),
api.path['start_dir'].join('skia', 'infra', 'bots', 'assets',

File diff suppressed because one or more lines are too long