Skip to content

Commit 0c2f61e

Browse files
erock2112Skia Commit-Bot
authored andcommitted
[recipes] Compute nanobench flags in gen_tasks
Change-Id: Ia37e0b9cd2f6b6c6e9a728741bec642cdba9f7b1 Reviewed-on: https://skia-review.googlesource.com/c/skia/+/274555 Commit-Queue: Eric Boren <[email protected]> Reviewed-by: Ben Wagner aka dogben <[email protected]>
1 parent d89a8b1 commit 0c2f61e

File tree

27 files changed

+166
-12842
lines changed

27 files changed

+166
-12842
lines changed

infra/bots/gen_tasks_logic/gen_tasks_logic.go

Lines changed: 37 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,12 @@ package gen_tasks_logic
99
*/
1010

1111
import (
12+
"bytes"
1213
"encoding/json"
1314
"fmt"
1415
"io/ioutil"
1516
"os"
17+
"os/exec"
1618
"path"
1719
"path/filepath"
1820
"regexp"
@@ -1519,7 +1521,40 @@ func (b *builder) perf(name string, parts map[string]string, compileTaskName str
15191521
recipe = "perf_skottiewasm_lottieweb"
15201522
isolate = "lottie_web.isolate"
15211523
}
1522-
task := b.kitchenTask(name, recipe, isolate, "", b.swarmDimensions(parts), EXTRA_PROPS, OUTPUT_PERF)
1524+
doUpload := strings.Contains(name, "Release") && b.doUpload(name)
1525+
extraProps := map[string]string{}
1526+
for k, v := range EXTRA_PROPS {
1527+
extraProps[k] = v
1528+
}
1529+
if recipe == "perf" {
1530+
nanoFlagsScript := filepath.Join(CheckoutRoot(), "infra", "bots", "recipe_modules", "vars", "resources", "nanobench_flags.py")
1531+
args := []string{
1532+
nanoFlagsScript,
1533+
"--bot", name,
1534+
"--parts", marshalJson(parts),
1535+
"--revision", specs.PLACEHOLDER_REVISION,
1536+
"--issue", specs.PLACEHOLDER_ISSUE,
1537+
"--patchset", specs.PLACEHOLDER_PATCHSET,
1538+
"--patch_storage", specs.PLACEHOLDER_PATCH_STORAGE,
1539+
}
1540+
if doUpload {
1541+
args = append(args, "--do_upload")
1542+
}
1543+
out, err := exec.Command("python", args...).CombinedOutput()
1544+
if err != nil {
1545+
glog.Fatal(err)
1546+
}
1547+
var res struct {
1548+
NanoFlags []string `json:"nanobench_flags"`
1549+
NanoProps map[string]string `json:"nanobench_properties"`
1550+
}
1551+
if err := json.NewDecoder(bytes.NewBuffer(out)).Decode(&res); err != nil {
1552+
glog.Fatal(err)
1553+
}
1554+
extraProps["nanobench_flags"] = marshalJson(res.NanoFlags)
1555+
extraProps["nanobench_properties"] = marshalJson(res.NanoProps)
1556+
}
1557+
task := b.kitchenTask(name, recipe, isolate, "", b.swarmDimensions(parts), extraProps, OUTPUT_PERF)
15231558
task.CipdPackages = append(task.CipdPackages, pkgs...)
15241559
if !strings.Contains(name, "LottieWeb") {
15251560
// Perf.+LottieWeb doesn't require anything in Skia to be compiled.
@@ -1562,7 +1597,7 @@ func (b *builder) perf(name string, parts map[string]string, compileTaskName str
15621597
b.MustAddTask(name, task)
15631598

15641599
// Upload results if necessary.
1565-
if strings.Contains(name, "Release") && b.doUpload(name) {
1600+
if doUpload {
15661601
uploadName := fmt.Sprintf("%s%s%s", PREFIX_UPLOAD, b.jobNameSchema.Sep, name)
15671602
extraProps := map[string]string{
15681603
"gs_bucket": b.cfg.GsBucketNano,

0 commit comments

Comments
 (0)