Skip to content
Merged
11 changes: 5 additions & 6 deletions runner/cmd/runner/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@ import (
"github.com/dstackai/dstack/runner/internal/log"
"github.com/dstackai/dstack/runner/internal/runner/api"
"github.com/sirupsen/logrus"
"github.com/ztrue/tracerr"
)

func main() {
Expand All @@ -21,17 +20,17 @@ func main() {

func start(tempDir string, homeDir string, httpPort int, sshPort int, logLevel int, version string) error {
if err := os.MkdirAll(tempDir, 0o755); err != nil {
return tracerr.Errorf("Failed to create temp directory: %w", err)
return fmt.Errorf("create temp directory: %w", err)
}

defaultLogFile, err := log.CreateAppendFile(filepath.Join(tempDir, consts.RunnerDefaultLogFileName))
if err != nil {
return tracerr.Errorf("Failed to create default log file: %w", err)
return fmt.Errorf("create default log file: %w", err)
}
defer func() {
err = defaultLogFile.Close()
if err != nil {
tracerr.Print(err)
log.Error(context.TODO(), "Failed to close default log file", "err", err)
}
}()

Expand All @@ -40,12 +39,12 @@ func start(tempDir string, homeDir string, httpPort int, sshPort int, logLevel i

server, err := api.NewServer(tempDir, homeDir, fmt.Sprintf(":%d", httpPort), sshPort, version)
if err != nil {
return tracerr.Errorf("Failed to create server: %w", err)
return fmt.Errorf("create server: %w", err)
}

log.Trace(context.TODO(), "Starting API server", "port", httpPort)
if err := server.Run(); err != nil {
return tracerr.Errorf("Server failed: %w", err)
return fmt.Errorf("server failed: %w", err)
}

return nil
Expand Down
4 changes: 2 additions & 2 deletions runner/cmd/shim/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -252,9 +252,9 @@ func start(ctx context.Context, args shim.CLIArgs, serviceMode bool) (err error)
if serviceMode {
if err := shim.WriteHostInfo(shimHomeDir, dockerRunner.Resources(ctx)); err != nil {
if errors.Is(err, os.ErrExist) {
log.Error(ctx, "cannot write host info: file already exists")
log.Error(ctx, "write host info: file already exists")
} else {
return err
return fmt.Errorf("write host info: %w", err)
}
}
}
Expand Down
1 change: 0 additions & 1 deletion runner/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ require (
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.10.0
github.com/urfave/cli/v2 v2.27.1
github.com/ztrue/tracerr v0.4.0
golang.org/x/crypto v0.22.0
golang.org/x/sys v0.26.0
)
Expand Down
2 changes: 0 additions & 2 deletions runner/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -196,8 +196,6 @@ github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9dec
github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY=
github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0=
github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0=
github.com/ztrue/tracerr v0.4.0 h1:vT5PFxwIGs7rCg9ZgJ/y0NmOpJkPCPFK8x0vVIYzd04=
github.com/ztrue/tracerr v0.4.0/go.mod h1:PaFfYlas0DfmXNpo7Eay4MFhZUONqvXM+T2HyGPpngk=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.50.0 h1:cEPbyTSEHlQR89XVlyo78gqluF8Y3oMeBkXGWzQsfXY=
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.50.0/go.mod h1:DKdbWcT4GH1D0Y3Sqt/PFXt2naRKDWtU+eE6oLdFNA8=
go.opentelemetry.io/otel v1.25.0 h1:gldB5FfhRl7OJQbUHt/8s0a7cE8fbsPAtdpRaApKy4k=
Expand Down
3 changes: 1 addition & 2 deletions runner/internal/common/interpolator.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ import (
"fmt"
"strings"

"github.com/dstackai/dstack/runner/internal/gerrors"
"github.com/dstackai/dstack/runner/internal/log"
)

Expand Down Expand Up @@ -52,7 +51,7 @@ func (vi *VariablesInterpolator) Interpolate(ctx context.Context, s string) (str
sb.WriteString(s[start:opening])
closing := IndexWithOffset(s, PatternClosing, opening)
if closing == -1 {
return "", gerrors.Newf("no pattern closing: %s", s[opening:])
return "", fmt.Errorf("no pattern closing: %s", s[opening:])
}

name := strings.TrimSpace(s[opening+len(PatternOpening) : closing])
Expand Down
Loading