Skip to content

Commit 77798d0

Browse files
committed
Only print debug messages when --debug is passed
The ones that are too verbose for normal usage. Signed-off-by: Eric Curtin <[email protected]>
1 parent 7fdb650 commit 77798d0

File tree

15 files changed

+31
-22
lines changed

15 files changed

+31
-22
lines changed

cmd/cli/commands/compose.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ func newUpCommand() *cobra.Command {
5151

5252
sendInfo("Initializing model runner...")
5353
kind := modelRunner.EngineKind()
54-
standalone, err := ensureStandaloneRunnerAvailable(cmd.Context(), nil)
54+
standalone, err := ensureStandaloneRunnerAvailable(cmd.Context(), nil, false)
5555
if err != nil {
5656
_ = sendErrorf("Failed to initialize standalone model runner: %v", err)
5757
return fmt.Errorf("Failed to initialize standalone model runner: %w", err)

cmd/cli/commands/inspect.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ func newInspectCmd() *cobra.Command {
2727
return nil
2828
},
2929
RunE: func(cmd *cobra.Command, args []string) error {
30-
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
30+
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
3131
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
3232
}
3333
if openai && remote {

cmd/cli/commands/install-runner.go

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ func inspectStandaloneRunner(container container.Summary) *standaloneRunner {
7878
// ensureStandaloneRunnerAvailable is a utility function that other commands can
7979
// use to initialize a default standalone model runner. It is a no-op in
8080
// unsupported contexts or if automatic installs have been disabled.
81-
func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.StatusPrinter) (*standaloneRunner, error) {
81+
func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.StatusPrinter, debug bool) (*standaloneRunner, error) {
8282
// If we're not in a supported model runner context, then don't do anything.
8383
engineKind := modelRunner.EngineKind()
8484
standaloneSupported := engineKind == types.ModelRunnerEngineKindMoby ||
@@ -138,7 +138,7 @@ func ensureStandaloneRunnerAvailable(ctx context.Context, printer standalone.Sta
138138
port = standalone.DefaultControllerPortCloud
139139
environment = "cloud"
140140
}
141-
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, host, environment, false, gpu, "", modelStorageVolume, printer, engineKind); err != nil {
141+
if err := standalone.CreateControllerContainer(ctx, dockerClient, port, host, environment, false, gpu, "", modelStorageVolume, printer, engineKind, false); err != nil {
142142
return nil, fmt.Errorf("unable to initialize standalone model runner container: %w", err)
143143
}
144144

@@ -175,7 +175,7 @@ type runnerOptions struct {
175175
}
176176

177177
// runInstallOrStart is shared logic for install-runner and start-runner commands
178-
func runInstallOrStart(cmd *cobra.Command, opts runnerOptions) error {
178+
func runInstallOrStart(cmd *cobra.Command, opts runnerOptions, debug bool) error {
179179
// Ensure that we're running in a supported model runner context.
180180
engineKind := modelRunner.EngineKind()
181181
if engineKind == types.ModelRunnerEngineKindDesktop {
@@ -282,7 +282,7 @@ func runInstallOrStart(cmd *cobra.Command, opts runnerOptions) error {
282282
return fmt.Errorf("unable to initialize standalone model storage: %w", err)
283283
}
284284
// Create the model runner container.
285-
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, opts.host, environment, opts.doNotTrack, gpu, opts.backend, modelStorageVolume, asPrinter(cmd), engineKind); err != nil {
285+
if err := standalone.CreateControllerContainer(cmd.Context(), dockerClient, port, opts.host, environment, opts.doNotTrack, gpu, opts.backend, modelStorageVolume, asPrinter(cmd), engineKind, debug); err != nil {
286286
return fmt.Errorf("unable to initialize standalone model runner container: %w", err)
287287
}
288288

@@ -296,6 +296,7 @@ func newInstallRunner() *cobra.Command {
296296
var gpuMode string
297297
var backend string
298298
var doNotTrack bool
299+
var debug bool
299300
c := &cobra.Command{
300301
Use: "install-runner",
301302
Short: "Install Docker Model Runner (Docker Engine only)",
@@ -308,7 +309,7 @@ func newInstallRunner() *cobra.Command {
308309
doNotTrack: doNotTrack,
309310
pullImage: true,
310311
pruneContainers: false,
311-
})
312+
}, debug)
312313
},
313314
ValidArgsFunction: completion.NoComplete,
314315
}
@@ -318,5 +319,6 @@ func newInstallRunner() *cobra.Command {
318319
c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda|rocm|musa|cann)")
319320
c.Flags().StringVar(&backend, "backend", "", backendUsage)
320321
c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner")
322+
c.Flags().BoolVar(&debug, "debug", false, "Enable debug logging")
321323
return c
322324
}

cmd/cli/commands/list.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ func newListCmd() *cobra.Command {
3636
if !jsonFormat && !openai && !quiet {
3737
standaloneInstallPrinter = asPrinter(cmd)
3838
}
39-
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), standaloneInstallPrinter); err != nil {
39+
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), standaloneInstallPrinter, false); err != nil {
4040
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
4141
}
4242
var modelFilter string

cmd/cli/commands/pull.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ func newPullCmd() *cobra.Command {
2828
return nil
2929
},
3030
RunE: func(cmd *cobra.Command, args []string) error {
31-
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
31+
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
3232
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
3333
}
3434
return pullModel(cmd, desktopClient, args[0], ignoreRuntimeMemoryCheck)

cmd/cli/commands/push.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ func newPushCmd() *cobra.Command {
2424
return nil
2525
},
2626
RunE: func(cmd *cobra.Command, args []string) error {
27-
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
27+
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
2828
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
2929
}
3030
return pushModel(cmd, desktopClient, args[0])

cmd/cli/commands/reinstall-runner.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ func newReinstallRunner() *cobra.Command {
1111
var gpuMode string
1212
var backend string
1313
var doNotTrack bool
14+
var debug bool
1415
c := &cobra.Command{
1516
Use: "reinstall-runner",
1617
Short: "Reinstall Docker Model Runner (Docker Engine only)",
@@ -23,7 +24,7 @@ func newReinstallRunner() *cobra.Command {
2324
doNotTrack: doNotTrack,
2425
pullImage: true,
2526
pruneContainers: true,
26-
})
27+
}, debug)
2728
},
2829
ValidArgsFunction: completion.NoComplete,
2930
}
@@ -33,5 +34,6 @@ func newReinstallRunner() *cobra.Command {
3334
c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda|musa|rocm|cann)")
3435
c.Flags().StringVar(&backend, "backend", "", backendUsage)
3536
c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner")
37+
c.Flags().BoolVar(&debug, "debug", false, "Enable debug logging")
3638
return c
3739
}

cmd/cli/commands/requests.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func newRequestsCmd() *cobra.Command {
2525
return nil
2626
},
2727
RunE: func(cmd *cobra.Command, args []string) error {
28-
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
28+
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
2929
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
3030
}
3131

cmd/cli/commands/restart-runner.go

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ func newRestartRunner() *cobra.Command {
1010
var host string
1111
var gpuMode string
1212
var doNotTrack bool
13+
var debug bool
1314
c := &cobra.Command{
1415
Use: "restart-runner",
1516
Short: "Restart Docker Model Runner (Docker Engine only)",
@@ -29,7 +30,7 @@ func newRestartRunner() *cobra.Command {
2930
gpuMode: gpuMode,
3031
doNotTrack: doNotTrack,
3132
pullImage: false,
32-
})
33+
}, debug)
3334
},
3435
ValidArgsFunction: completion.NoComplete,
3536
}
@@ -38,5 +39,6 @@ func newRestartRunner() *cobra.Command {
3839
c.Flags().StringVar(&host, "host", "127.0.0.1", "Host address to bind Docker Model Runner")
3940
c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda|musa|rocm|cann)")
4041
c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner")
42+
c.Flags().BoolVar(&debug, "debug", false, "Enable debug logging")
4143
return c
4244
}

cmd/cli/commands/rm.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ func newRemoveCmd() *cobra.Command {
2525
return nil
2626
},
2727
RunE: func(cmd *cobra.Command, args []string) error {
28-
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd)); err != nil {
28+
if _, err := ensureStandaloneRunnerAvailable(cmd.Context(), asPrinter(cmd), false); err != nil {
2929
return fmt.Errorf("unable to initialize standalone model runner: %w", err)
3030
}
3131
response, err := desktopClient.Remove(args, force)

0 commit comments

Comments
 (0)