Skip to content

Commit

Permalink
debug: print error message on monitor instead of processes pkg
Browse files Browse the repository at this point in the history
This can catch and print more errors on monitor side not only process-related
errors.

Signed-off-by: Kohei Tokunaga <[email protected]>
  • Loading branch information
ktock committed Oct 18, 2023
1 parent 14b7dde commit 057a647
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
6 changes: 1 addition & 5 deletions controller/processes/processes.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,11 +137,7 @@ func (m *Manager) StartProcess(pid string, resultCtx *build.ResultHandle, cfg *p
go func() {
var err error
if err = ctr.Exec(ctx, cfg, in.Stdin, in.Stdout, in.Stderr); err != nil {
if errors.Is(err, context.Canceled) {
logrus.Debugf("process canceled: %v", err)
} else {
logrus.Errorf("failed to exec process: %v", err)
}
logrus.Debugf("process error: %v", err)
}
logrus.Debugf("finished process %s %v", pid, cfg.Entrypoint)
m.processes.Delete(pid)
Expand Down
6 changes: 5 additions & 1 deletion monitor/monitor.go
Original file line number Diff line number Diff line change
Expand Up @@ -302,7 +302,11 @@ func (m *monitor) startInvoke(ctx context.Context, pid string, cfg controllerapi
go func() {
// Start a new invoke
if err := m.invoke(ctx, pid, cfg); err != nil {
logrus.Debugf("invoke error: %v", err)
if errors.Is(err, context.Canceled) {
logrus.Debugf("process canceled: %v", err)
} else {
logrus.Errorf("invoke: %v", err)
}
}
if pid == m.attachedPid.Load() {
m.attachedPid.Store("")
Expand Down

0 comments on commit 057a647

Please sign in to comment.