feat(executor): debug log protobuf sizes only
This commit is contained in:
parent
8bc1b8284d
commit
ce794f1315
2
go.mod
2
go.mod
|
@ -11,6 +11,7 @@ require (
|
||||||
github.com/mcuadros/go-defaults v1.2.0
|
github.com/mcuadros/go-defaults v1.2.0
|
||||||
github.com/mitchellh/mapstructure v1.5.0
|
github.com/mitchellh/mapstructure v1.5.0
|
||||||
google.golang.org/grpc v1.67.1
|
google.golang.org/grpc v1.67.1
|
||||||
|
google.golang.org/protobuf v1.35.1
|
||||||
)
|
)
|
||||||
|
|
||||||
require (
|
require (
|
||||||
|
@ -41,7 +42,6 @@ require (
|
||||||
golang.org/x/sys v0.26.0 // indirect
|
golang.org/x/sys v0.26.0 // indirect
|
||||||
golang.org/x/text v0.19.0 // indirect
|
golang.org/x/text v0.19.0 // indirect
|
||||||
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
|
google.golang.org/genproto/googleapis/rpc v0.0.0-20241021214115-324edc3d5d38 // indirect
|
||||||
google.golang.org/protobuf v1.35.1 // indirect
|
|
||||||
gopkg.in/warnings.v0 v0.1.2 // indirect
|
gopkg.in/warnings.v0 v0.1.2 // indirect
|
||||||
gopkg.in/yaml.v2 v2.4.0 // indirect
|
gopkg.in/yaml.v2 v2.4.0 // indirect
|
||||||
)
|
)
|
||||||
|
|
|
@ -7,6 +7,7 @@ import (
|
||||||
|
|
||||||
"github.com/criyle/go-judge/pb"
|
"github.com/criyle/go-judge/pb"
|
||||||
"github.com/joint-online-judge/JOJ3/internal/stage"
|
"github.com/joint-online-judge/JOJ3/internal/stage"
|
||||||
|
"google.golang.org/protobuf/proto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Sandbox struct {
|
type Sandbox struct {
|
||||||
|
@ -37,7 +38,24 @@ func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
pbCmds := convertPBCmd(cmds)
|
pbCmds := convertPBCmd(cmds)
|
||||||
slog.Debug("sandbox execute", "protobuf cmds", pbCmds)
|
for i, pbCmd := range pbCmds {
|
||||||
|
slog.Debug(
|
||||||
|
"sandbox execute",
|
||||||
|
"index", i,
|
||||||
|
"protobuf cmd size", proto.Size(pbCmd),
|
||||||
|
"protobuf cmd stdin size", proto.Size(pbCmd.Files[0]),
|
||||||
|
"protobuf cmd stdout size", proto.Size(pbCmd.Files[1]),
|
||||||
|
"protobuf cmd stderr size", proto.Size(pbCmd.Files[2]),
|
||||||
|
)
|
||||||
|
for k, v := range pbCmd.CopyIn {
|
||||||
|
slog.Debug(
|
||||||
|
"sandbox execute",
|
||||||
|
"index", i,
|
||||||
|
"CopyIn filename", k,
|
||||||
|
"protobuf file size", proto.Size(v),
|
||||||
|
)
|
||||||
|
}
|
||||||
|
}
|
||||||
pbReq := &pb.Request{Cmd: pbCmds}
|
pbReq := &pb.Request{Cmd: pbCmds}
|
||||||
pbRet, err := e.execClient.Exec(context.TODO(), pbReq)
|
pbRet, err := e.execClient.Exec(context.TODO(), pbReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
|
Loading…
Reference in New Issue
Block a user