|
7 | 7 | from rich.console import Console |
8 | 8 | from rich.live import Live |
9 | 9 |
|
10 | | -import vec_inf.client._utils as utils |
11 | 10 | from vec_inf.cli._helper import ( |
12 | 11 | LaunchResponseFormatter, |
13 | 12 | ListCmdDisplay, |
14 | 13 | MetricsResponseFormatter, |
15 | 14 | StatusResponseFormatter, |
16 | 15 | ) |
17 | | -from vec_inf.client._models import LaunchOptions |
| 16 | +from vec_inf.client._models import LaunchOptions, LaunchOptionsDict |
18 | 17 | from vec_inf.client.api import VecInfClient |
19 | 18 |
|
20 | 19 |
|
@@ -129,14 +128,15 @@ def cli() -> None: |
129 | 128 | ) |
130 | 129 | def launch( |
131 | 130 | model_name: str, |
132 | | - **cli_kwargs: Optional[Union[str, int, bool]], |
| 131 | + **cli_kwargs: Optional[Union[str, int, float, bool]], |
133 | 132 | ) -> None: |
134 | 133 | """Launch a model on the cluster.""" |
135 | 134 | try: |
136 | 135 | # Convert cli_kwargs to LaunchOptions |
137 | | - launch_options = LaunchOptions( |
138 | | - **{k: v for k, v in cli_kwargs.items() if k != "json_mode"} |
139 | | - ) |
| 136 | + kwargs = {k: v for k, v in cli_kwargs.items() if k != "json_mode"} |
| 137 | + # Cast the dictionary to LaunchOptionsDict |
| 138 | + options_dict: LaunchOptionsDict = kwargs # type: ignore |
| 139 | + launch_options = LaunchOptions(**options_dict) |
140 | 140 |
|
141 | 141 | # Start the client and launch model inference server |
142 | 142 | client = VecInfClient() |
@@ -194,8 +194,12 @@ def status( |
194 | 194 | @click.argument("slurm_job_id", type=int, nargs=1) |
195 | 195 | def shutdown(slurm_job_id: int) -> None: |
196 | 196 | """Shutdown a running model on the cluster.""" |
197 | | - utils.shutdown_model(slurm_job_id) |
198 | | - click.echo(f"Shutting down model with Slurm Job ID: {slurm_job_id}") |
| 197 | + try: |
| 198 | + client = VecInfClient() |
| 199 | + client.shutdown_model(slurm_job_id) |
| 200 | + click.echo(f"Shutting down model with Slurm Job ID: {slurm_job_id}") |
| 201 | + except Exception as e: |
| 202 | + raise click.ClickException(f"Shutdown failed: {str(e)}") from e |
199 | 203 |
|
200 | 204 |
|
201 | 205 | @cli.command("list") |
|
0 commit comments