-
Notifications
You must be signed in to change notification settings - Fork 80
Add start-runner, restart-runner and stop-runner commands #216
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package commands | ||
|
|
||
| import ( | ||
| "github.com/docker/model-runner/cmd/cli/commands/completion" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func newRestartRunner() *cobra.Command { | ||
| var port uint16 | ||
| var host string | ||
ericcurtin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| var gpuMode string | ||
| var doNotTrack bool | ||
| c := &cobra.Command{ | ||
| Use: "restart-runner", | ||
| Short: "Restart Docker Model Runner (Docker Engine only)", | ||
ericcurtin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| // First stop the runner without removing models or images | ||
| if err := runUninstallOrStop(cmd, cleanupOptions{ | ||
| models: false, | ||
| removeImages: false, | ||
| }); err != nil { | ||
| return err | ||
| } | ||
|
|
||
| // Then start the runner with the provided options | ||
| return runInstallOrStart(cmd, runnerOptions{ | ||
| port: port, | ||
| host: host, | ||
| gpuMode: gpuMode, | ||
| doNotTrack: doNotTrack, | ||
| pullImage: false, | ||
| }) | ||
| }, | ||
| ValidArgsFunction: completion.NoComplete, | ||
| } | ||
| c.Flags().Uint16Var(&port, "port", 0, | ||
| "Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode)") | ||
| c.Flags().StringVar(&host, "host", "127.0.0.1", "Host address to bind Docker Model Runner") | ||
| c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda)") | ||
| c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner") | ||
| return c | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| package commands | ||
|
|
||
| import ( | ||
| "github.com/docker/model-runner/cmd/cli/commands/completion" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func newStartRunner() *cobra.Command { | ||
| var port uint16 | ||
| var gpuMode string | ||
| var doNotTrack bool | ||
| c := &cobra.Command{ | ||
| Use: "start-runner", | ||
| Short: "Start Docker Model Runner (Docker Engine only)", | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| return runInstallOrStart(cmd, runnerOptions{ | ||
| port: port, | ||
| gpuMode: gpuMode, | ||
| doNotTrack: doNotTrack, | ||
| pullImage: false, | ||
ericcurtin marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| }) | ||
| }, | ||
| ValidArgsFunction: completion.NoComplete, | ||
| } | ||
| c.Flags().Uint16Var(&port, "port", 0, | ||
| "Docker container port for Docker Model Runner (default: 12434 for Docker Engine, 12435 for Cloud mode)") | ||
| c.Flags().StringVar(&gpuMode, "gpu", "auto", "Specify GPU support (none|auto|cuda)") | ||
| c.Flags().BoolVar(&doNotTrack, "do-not-track", false, "Do not track models usage in Docker Model Runner") | ||
| return c | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| package commands | ||
|
|
||
| import ( | ||
| "github.com/docker/model-runner/cmd/cli/commands/completion" | ||
| "github.com/spf13/cobra" | ||
| ) | ||
|
|
||
| func newStopRunner() *cobra.Command { | ||
| var models bool | ||
| c := &cobra.Command{ | ||
| Use: "stop-runner", | ||
| Short: "Stop Docker Model Runner (Docker Engine only)", | ||
| RunE: func(cmd *cobra.Command, args []string) error { | ||
| return runUninstallOrStop(cmd, cleanupOptions{ | ||
| models: models, | ||
| removeImages: false, | ||
| }) | ||
| }, | ||
| ValidArgsFunction: completion.NoComplete, | ||
| } | ||
| c.Flags().BoolVar(&models, "models", false, "Remove model storage volume") | ||
| return c | ||
| } |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is
docker-model?