docs(executor/sandbox): note on 1 cmd each time
All checks were successful
submodules sync / sync (push) Successful in 42s
build / build (push) Successful in 2m38s
build / trigger-build-image (push) Successful in 14s

This commit is contained in:
张泊明518370910136 2025-04-05 06:27:36 -04:00
parent b8f782c17d
commit 4f916c79d4
GPG Key ID: D47306D7062CDA9D

View File

@ -32,10 +32,10 @@ func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
cmd.CopyIn[k] = stage.CmdFile{FileID: &fileID}
}
}
// NOTE: send all cmds at once may cause oom, no idea on why
pbCmd := convertPBCmd([]stage.Cmd{*cmd})
slog.Debug("sandbox execute", "i", i, "pbCmd size", proto.Size(pbCmd[0]))
pbReq := &pb.Request{Cmd: pbCmd}
slog.Debug("sandbox execute", "pbReq size", proto.Size(pbReq))
slog.Debug("sandbox execute", "i", i, "pbReq size", proto.Size(pbReq))
pbRet, err := e.execClient.Exec(context.TODO(), pbReq)
if err != nil {
return nil, err
@ -43,6 +43,9 @@ func (e *Sandbox) Run(cmds []stage.Cmd) ([]stage.ExecutorResult, error) {
if pbRet.Error != "" {
return nil, fmt.Errorf("sandbox execute error: %s", pbRet.Error)
}
if len(pbRet.Results) == 0 {
return nil, fmt.Errorf("sandbox execute error: no result")
}
result := convertPBResult(pbRet.Results)[0]
maps.Copy(e.cachedMap, result.FileIDs)
results[i] = result