Skip to content

Commit

Permalink
feat(cli): Support command flag in deploy (#95)
Browse files Browse the repository at this point in the history
Signed-off-by: Ce Gao <[email protected]>
  • Loading branch information
gaocegege authored Aug 2, 2023
1 parent 943761c commit 0aeb6c0
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 1 deletion.
4 changes: 3 additions & 1 deletion mdz/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@ CLI for OpenModelZ.

## Installation

TODO
```
pip install openmodelz
```

## CLI Reference

Expand Down
6 changes: 6 additions & 0 deletions mdz/pkg/cmd/deploy.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ var (
deployName string
deployGPU int
deployNodeLabel []string
deployCommand string
)

// deployCmd represents the deploy command
Expand Down Expand Up @@ -53,6 +54,7 @@ func init() {
deployCmd.Flags().IntVar(&deployGPU, "gpu", 0, "Number of GPUs")
deployCmd.Flags().StringVar(&deployName, "name", "", "Name of inference")
deployCmd.Flags().StringSliceVarP(&deployNodeLabel, "node-labels", "l", []string{}, "Node labels")
deployCmd.Flags().StringVar(&deployCommand, "command", "", "Command to run")
}

func commandDeploy(cmd *cobra.Command, args []string) error {
Expand Down Expand Up @@ -87,6 +89,10 @@ func commandDeploy(cmd *cobra.Command, args []string) error {
},
}

if deployCommand != "" {
inf.Spec.Command = &deployCommand
}

if len(deployNodeLabel) > 0 {
inf.Spec.Constraints = []string{}
for _, label := range deployNodeLabel {
Expand Down

0 comments on commit 0aeb6c0

Please sign in to comment.