Skip to content

Commit 21ae9ee

Browse files
committed
Add build dimensions to robot workers.
The robot webserver needed to have a better understanding of packages and builds. Prior to this change builds were typically looked at through the lense of the GapidAPK and Gapit versions that were used to trace. This caused multiple issues aside from just being not user-friendly. We now have a package id used with the input for each worker, and the webserver recognizes that as a separate dimension. A separate dimension is used to hold the build that was used for tracing specifically, since that feeds into the input for Report and Replay. The Host dimension now identifies the host machine that runs the worker, rather than the host machine that ran the trace which is less useful, as we already have the target as a dimension. Also need a template function mapping to test if a package type is User or not.
1 parent e889840 commit 21ae9ee

File tree

9 files changed

+115
-157
lines changed

9 files changed

+115
-157
lines changed

test/robot/replay/replay.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,8 @@ message Input {
3636
// VirtualSwapChainLib is the stash id of the vulkan virtual-swap-chain loader
3737
// json file.
3838
string virtual_swap_chain_json = 6;
39+
// Package is the stash id of the package used to generate the report.
40+
string package = 7;
3941
}
4042

4143
// Output holds the outputs of a replay action.

test/robot/report/report.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,8 @@ message Input{
2828
string gapit = 2;
2929
// Gapis is the stash id of the graphics analysis server to use.
3030
string gapis = 3;
31+
// Package is the stash id of the package used to generate the report.
32+
string package = 4;
3133
}
3234

3335
// Output describes the outputs of a report action.

test/robot/scheduler/replay.go

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -24,36 +24,20 @@ import (
2424
"github.com/google/gapid/test/robot/replay"
2525
)
2626

27-
func (s schedule) getReplayTargetTools(ctx context.Context) *build.ToolSet {
28-
ctx = log.V{"target": s.worker.Target}.Bind(ctx)
29-
tools := s.pkg.FindTools(ctx, s.data.FindDevice(s.worker.Target))
30-
if tools == nil {
31-
return nil
32-
}
33-
if tools.Host.Gapir == "" {
34-
return nil
35-
}
36-
return tools
37-
}
38-
39-
func (s schedule) doReplay(ctx context.Context, t *monitor.Trace) error {
27+
func (s schedule) doReplay(ctx context.Context, t *monitor.Trace, tools *build.ToolSet) error {
4028
if !s.worker.Supports(job.Replay) {
4129
return nil
4230
}
4331
ctx = log.Enter(ctx, "Replay")
4432
ctx = log.V{"Package": s.pkg.Id}.Bind(ctx)
45-
hostTools := s.getHostTools(ctx)
46-
targetTools := s.getReplayTargetTools(ctx)
47-
if hostTools == nil || targetTools == nil {
48-
return log.Err(ctx, nil, "Failed to find tools for report!")
49-
}
5033
input := &replay.Input{
5134
Trace: t.Action.Output.Trace,
52-
Gapit: hostTools.Host.Gapit,
53-
Gapis: hostTools.Host.Gapis,
54-
Gapir: targetTools.Host.Gapir,
55-
VirtualSwapChainLib: targetTools.Host.VirtualSwapChainLib,
56-
VirtualSwapChainJson: targetTools.Host.VirtualSwapChainJson,
35+
Gapit: tools.Host.Gapit,
36+
Gapis: tools.Host.Gapis,
37+
Gapir: tools.Host.Gapir,
38+
VirtualSwapChainLib: tools.Host.VirtualSwapChainLib,
39+
VirtualSwapChainJson: tools.Host.VirtualSwapChainJson,
40+
Package: s.pkg.Id,
5741
}
5842
action := &replay.Action{
5943
Input: input,

test/robot/scheduler/report.go

Lines changed: 6 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,25 +18,23 @@ import (
1818
"context"
1919

2020
"github.com/google/gapid/core/log"
21+
"github.com/google/gapid/test/robot/build"
2122
"github.com/google/gapid/test/robot/job"
2223
"github.com/google/gapid/test/robot/monitor"
2324
"github.com/google/gapid/test/robot/report"
2425
)
2526

26-
func (s schedule) doReport(ctx context.Context, t *monitor.Trace) error {
27+
func (s schedule) doReport(ctx context.Context, t *monitor.Trace, tools *build.ToolSet) error {
2728
if !s.worker.Supports(job.Report) {
2829
return nil
2930
}
3031
ctx = log.Enter(ctx, "Report")
3132
ctx = log.V{"Package": s.pkg.Id}.Bind(ctx)
32-
hostTools := s.getHostTools(ctx)
33-
if hostTools == nil {
34-
return log.Err(ctx, nil, "Failed to find tools for report!")
35-
}
3633
input := &report.Input{
37-
Trace: t.Action.Output.Trace,
38-
Gapit: hostTools.Host.Gapit,
39-
Gapis: hostTools.Host.Gapis,
34+
Trace: t.Action.Output.Trace,
35+
Gapit: tools.Host.Gapit,
36+
Gapis: tools.Host.Gapis,
37+
Package: s.pkg.Id,
4038
}
4139
action := &report.Action{
4240
Input: input,

test/robot/scheduler/scheduler.go

Lines changed: 38 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -49,23 +49,27 @@ func Tick(ctx context.Context, managers *monitor.Managers, data *monitor.Data) [
4949
s.pkg = pkg
5050
for _, w := range data.Workers.All() {
5151
s.worker = w
52-
for _, subj := range data.Subjects.All() {
53-
if err := s.doTrace(ctx, subj); err != nil {
54-
errs = append(errs, err)
52+
if tools := s.getHostTools(ctx); tools != nil {
53+
for _, subj := range data.Subjects.All() {
54+
if android_tools := s.getAndroidTools(ctx, subj); android_tools != nil {
55+
if err := s.doTrace(ctx, subj, tools, android_tools); err != nil {
56+
errs = append(errs, err)
57+
}
58+
}
5559
}
56-
}
57-
for _, t := range data.Traces.All() {
58-
if t.Status != job.Succeeded {
59-
continue
60-
}
61-
if t.Output == nil {
62-
continue
63-
}
64-
if err := s.doReport(ctx, t); err != nil {
65-
errs = append(errs, err)
66-
}
67-
if err := s.doReplay(ctx, t); err != nil {
68-
errs = append(errs, err)
60+
for _, t := range data.Traces.All() {
61+
if t.Status != job.Succeeded {
62+
continue
63+
}
64+
if t.Output == nil {
65+
continue
66+
}
67+
if err := s.doReport(ctx, t, tools); err != nil {
68+
errs = append(errs, err)
69+
}
70+
if err := s.doReplay(ctx, t, tools); err != nil {
71+
errs = append(errs, err)
72+
}
6973
}
7074
}
7175
}
@@ -88,5 +92,23 @@ func (s schedule) getHostTools(ctx context.Context) *build.ToolSet {
8892
if tools.Host.Gapir == "" {
8993
return nil
9094
}
95+
if tools.Host.VirtualSwapChainLib == "" {
96+
return nil
97+
}
98+
if tools.Host.VirtualSwapChainJson == "" {
99+
return nil
100+
}
101+
return tools
102+
}
103+
104+
func (s schedule) getAndroidTools(ctx context.Context, subj *monitor.Subject) *build.AndroidToolSet {
105+
ctx = log.V{"target": s.worker.Target}.Bind(ctx)
106+
tools := s.pkg.FindToolsForAPK(ctx, s.data.FindDevice(s.worker.Host), s.data.FindDevice(s.worker.Target), subj.GetAPK())
107+
if tools == nil {
108+
return nil
109+
}
110+
if tools.GapidApk == "" {
111+
return nil
112+
}
91113
return tools
92114
}

test/robot/scheduler/trace.go

Lines changed: 5 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,37 +24,20 @@ import (
2424
"github.com/google/gapid/test/robot/trace"
2525
)
2626

27-
func (s schedule) getTraceTargetTools(ctx context.Context, subj *monitor.Subject) *build.AndroidToolSet {
28-
ctx = log.V{"target": s.worker.Target}.Bind(ctx)
29-
tools := s.pkg.FindToolsForAPK(ctx, s.data.FindDevice(s.worker.Host), s.data.FindDevice(s.worker.Target), subj.GetAPK())
30-
31-
if tools == nil {
32-
return nil
33-
}
34-
if tools.GapidApk == "" {
35-
return nil
36-
}
37-
return tools
38-
}
39-
40-
func (s schedule) doTrace(ctx context.Context, subj *monitor.Subject) error {
27+
func (s schedule) doTrace(ctx context.Context, subj *monitor.Subject, tools *build.ToolSet, androidTools *build.AndroidToolSet) error {
4128
if !s.worker.Supports(job.Trace) {
4229
return nil
4330
}
4431
ctx = log.Enter(ctx, "Trace")
4532
ctx = log.V{"Package": s.pkg.Id}.Bind(ctx)
46-
hostTools := s.getHostTools(ctx)
47-
targetTools := s.getTraceTargetTools(ctx, subj)
48-
if hostTools == nil || targetTools == nil {
49-
return log.Err(ctx, nil, "Failed to find tools for trace!")
50-
}
5133
input := &trace.Input{
5234
Subject: subj.Id,
53-
Gapit: hostTools.Host.Gapit,
54-
GapidApk: targetTools.GapidApk,
35+
Gapit: tools.Host.Gapit,
36+
GapidApk: androidTools.GapidApk,
37+
Package: s.pkg.Id,
5538
Hints: subj.Hints,
5639
Layout: &trace.ToolingLayout{
57-
GapidAbi: targetTools.Abi,
40+
GapidAbi: androidTools.Abi,
5841
},
5942
}
6043
action := &trace.Action{

test/robot/trace/trace.proto

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,8 @@ message Input {
3434
subject.Hints hints = 4;
3535
// layout represents details about what tools we're using to trace.
3636
ToolingLayout layout = 5;
37+
// Package is the stash id of the package used to trace.
38+
string package = 6;
3739
}
3840

3941
// ToolingLayout describes tools we use for tracing.

test/robot/web/client/client.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,17 +25,17 @@ import (
2525
)
2626

2727
type traceInfo struct {
28-
target Item
29-
gapidApk Item
30-
gapit Item
31-
subject Item
32-
host Item
28+
target Item
29+
pkg Item
30+
subject Item
3331
}
3432

3533
type task struct {
3634
trace traceInfo
3735

3836
kind Item
37+
host Item
38+
pkg Item
3939
result grid.Result
4040
status grid.Status
4141

@@ -45,10 +45,10 @@ type task struct {
4545
func (t *task) Representation() interface{} {
4646
tr := map[string]interface{}{}
4747
tr["trace target"] = t.trace.target.Underlying()
48-
tr["trace host"] = t.trace.host.Underlying()
4948
tr["trace subject"] = t.trace.subject.Underlying()
50-
tr["trace gapid.apk"] = t.trace.gapidApk.Underlying()
51-
tr["trace gapit"] = t.trace.gapit.Underlying()
49+
tr["trace package"] = t.trace.pkg.Underlying()
50+
tr["host"] = t.host.Underlying()
51+
tr["package"] = t.pkg.Underlying()
5252
return []interface{}{tr, t.underlying}
5353
}
5454

0 commit comments

Comments
 (0)