Skip to content

Commit ac875f6

Browse files
authored
Reorganize Go codebase (#3628)
The new structure: <root>/ go.mod cmd/ runner/ shim/ internal/ common/ runner/ shim/
1 parent 9eea926 commit ac875f6

57 files changed

Lines changed: 224 additions & 366 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

runner/cmd/runner/main.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,12 +14,12 @@ import (
1414
"github.com/sirupsen/logrus"
1515
"github.com/urfave/cli/v3"
1616

17-
"github.com/dstackai/dstack/runner/consts"
18-
"github.com/dstackai/dstack/runner/internal/executor"
19-
linuxuser "github.com/dstackai/dstack/runner/internal/linux/user"
20-
"github.com/dstackai/dstack/runner/internal/log"
17+
"github.com/dstackai/dstack/runner/internal/common/consts"
18+
"github.com/dstackai/dstack/runner/internal/common/log"
2119
"github.com/dstackai/dstack/runner/internal/runner/api"
22-
"github.com/dstackai/dstack/runner/internal/ssh"
20+
"github.com/dstackai/dstack/runner/internal/runner/executor"
21+
linuxuser "github.com/dstackai/dstack/runner/internal/runner/linux/user"
22+
"github.com/dstackai/dstack/runner/internal/runner/ssh"
2323
)
2424

2525
// Version is a build-time variable. The value is overridden by ldflags.

runner/cmd/shim/main.go

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ import (
1515
"github.com/sirupsen/logrus"
1616
"github.com/urfave/cli/v3"
1717

18-
"github.com/dstackai/dstack/runner/consts"
19-
"github.com/dstackai/dstack/runner/internal/common"
20-
"github.com/dstackai/dstack/runner/internal/log"
18+
"github.com/dstackai/dstack/runner/internal/common/consts"
19+
"github.com/dstackai/dstack/runner/internal/common/gpu"
20+
"github.com/dstackai/dstack/runner/internal/common/log"
2121
"github.com/dstackai/dstack/runner/internal/shim"
2222
"github.com/dstackai/dstack/runner/internal/shim/api"
2323
"github.com/dstackai/dstack/runner/internal/shim/components"
@@ -236,7 +236,7 @@ func start(ctx context.Context, args shim.CLIArgs, serviceMode bool) (err error)
236236
var dcgmExporter *dcgm.DCGMExporter
237237
var dcgmWrapper dcgm.DCGMWrapperInterface
238238

239-
if common.GetGpuVendor() == common.GpuVendorNvidia {
239+
if gpu.GetGpuVendor() == gpu.GpuVendorNvidia {
240240
dcgmExporterPath, err := dcgm.GetDCGMExporterExecPath(ctx)
241241
if err == nil {
242242
interval := time.Duration(args.DCGMExporter.Interval * int(time.Millisecond))
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import (
1010

1111
"github.com/golang/gddo/httputil/header"
1212

13-
"github.com/dstackai/dstack/runner/internal/log"
13+
"github.com/dstackai/dstack/runner/internal/common/log"
1414
)
1515

1616
type Error struct {
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package common
1+
package gpu
22

33
import (
44
"errors"

runner/internal/common/interpolator.go

Lines changed: 0 additions & 67 deletions
This file was deleted.

runner/internal/common/interpolator_test.go

Lines changed: 0 additions & 64 deletions
This file was deleted.

runner/internal/common/string.go

Lines changed: 0 additions & 11 deletions
This file was deleted.
Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -11,13 +11,3 @@ const (
1111
TerminationReasonTerminatedByServer TerminationReason = "terminated_by_server"
1212
TerminationReasonMaxDurationExceeded TerminationReason = "max_duration_exceeded"
1313
)
14-
15-
type JobState string
16-
17-
const (
18-
JobStateDone JobState = "done"
19-
JobStateFailed JobState = "failed"
20-
JobStateRunning JobState = "running"
21-
JobStateTerminated JobState = "terminated"
22-
JobStateTerminating JobState = "terminating"
23-
)

0 commit comments

Comments
 (0)