Skip to content

Commit 35b96dc

Browse files
[pre-commit.ci] Add auto fixes from pre-commit.com hooks
for more information, see https://pre-commit.ci
1 parent ed0a5dd commit 35b96dc

File tree

6 files changed

+24
-28
lines changed

6 files changed

+24
-28
lines changed

tests/vec_inf/cli/test_cli.py

Lines changed: 5 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -330,9 +330,7 @@ def test_launch_command_no_model_weights_parent_dir(runner, debug_helper, base_p
330330
stack.enter_context(patch_obj)
331331

332332
# Mock load_config to return empty list
333-
stack.enter_context(
334-
patch("vec_inf.client._utils.load_config", return_value=[])
335-
)
333+
stack.enter_context(patch("vec_inf.client._utils.load_config", return_value=[]))
336334

337335
result = runner.invoke(cli, ["launch", "test-model"])
338336
debug_helper.print_debug_info(result)
@@ -376,9 +374,7 @@ def test_launch_command_model_not_in_config_with_weights(
376374
)
377375

378376

379-
def test_launch_command_model_not_found(
380-
runner, debug_helper, test_paths, base_patches
381-
):
377+
def test_launch_command_model_not_found(runner, debug_helper, test_paths, base_patches):
382378
"""Test handling of a model that's neither in config nor has weights."""
383379

384380
def custom_path_exists(p):
@@ -410,8 +406,7 @@ def custom_path_exists(p):
410406
assert result.exit_code == 1
411407
assert (
412408
"'unknown-model' not found in configuration and model weights "
413-
"not found at expected path '/model-weights/unknown-model'"
414-
in result.output
409+
"not found at expected path '/model-weights/unknown-model'" in result.output
415410
)
416411

417412

@@ -450,10 +445,7 @@ def test_metrics_command_pending_server(
450445

451446
assert result.exit_code == 0
452447
assert "ERROR" in result.output
453-
assert (
454-
"Pending resources for server initialization"
455-
in result.output
456-
)
448+
assert "Pending resources for server initialization" in result.output
457449

458450

459451
def test_metrics_command_server_not_ready(
@@ -473,10 +465,7 @@ def test_metrics_command_server_not_ready(
473465

474466
assert result.exit_code == 0
475467
assert "ERROR" in result.output
476-
assert (
477-
"Server not ready"
478-
in result.output
479-
)
468+
assert "Server not ready" in result.output
480469

481470

482471
@patch("requests.get")

vec_inf/cli/_cli.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,7 +134,9 @@ def launch(
134134
"""Launch a model on the cluster."""
135135
try:
136136
# Convert cli_kwargs to LaunchOptions
137-
launch_options = LaunchOptions(**{k: v for k, v in cli_kwargs.items() if k != "json_mode"})
137+
launch_options = LaunchOptions(
138+
**{k: v for k, v in cli_kwargs.items() if k != "json_mode"}
139+
)
138140

139141
# Start the client and launch model inference server
140142
client = VecInfClient()

vec_inf/cli/_helper.py

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
from vec_inf.client._models import ModelInfo, StatusResponse
1616

1717

18-
class LaunchResponseFormatter():
18+
class LaunchResponseFormatter:
1919
"""CLI Helper class for formatting LaunchResponse."""
2020

2121
def __init__(self, model_name: str, params: dict[str, Any]):
@@ -68,7 +68,7 @@ def format_table_output(self) -> Table:
6868
return table
6969

7070

71-
class StatusResponseFormatter():
71+
class StatusResponseFormatter:
7272
"""CLI Helper class for formatting StatusResponse."""
7373

7474
def __init__(self, status_info: StatusResponse):
@@ -102,7 +102,7 @@ def output_table(self) -> Table:
102102
return table
103103

104104

105-
class MetricsResponseFormatter():
105+
class MetricsResponseFormatter:
106106
"""CLI Helper class for formatting MetricsResponse."""
107107

108108
def __init__(self, metrics: dict[str, float]):
@@ -189,7 +189,7 @@ def format_metrics(self) -> None:
189189
)
190190

191191

192-
class ListCmdDisplay():
192+
class ListCmdDisplay:
193193
"""CLI Helper class for displaying model listing functionality."""
194194

195195
def __init__(self, console: Console, json_mode: bool = False):
@@ -218,7 +218,9 @@ def _format_single_model_output(
218218
table.add_row(field, str(value))
219219
return table
220220

221-
def _format_all_models_output(self, model_infos: list[ModelInfo]) -> Union[list[str], list[Panel]]:
221+
def _format_all_models_output(
222+
self, model_infos: list[ModelInfo]
223+
) -> Union[list[str], list[Panel]]:
222224
"""Format output table for all models."""
223225
# Sort by model type priority
224226
sorted_model_infos = sorted(
@@ -254,4 +256,3 @@ def display_all_models_output(self, model_infos: list[ModelInfo]) -> None:
254256
else:
255257
panels = self._format_all_models_output(model_infos)
256258
self.console.print(Columns(panels, equal=True))
257-

vec_inf/client/_helper.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,9 @@ def _get_model_configuration(self) -> ModelConfig:
7474
)
7575

7676
if not model_weights_parent_dir:
77-
raise ModelNotFoundError("Could not determine model weights parent directory")
77+
raise ModelNotFoundError(
78+
"Could not determine model weights parent directory"
79+
)
7880

7981
model_weights_path = Path(model_weights_parent_dir, self.model_name)
8082

@@ -284,7 +286,9 @@ def _process_running_state(self) -> None:
284286
)
285287

286288
if isinstance(server_status, tuple):
287-
self.status_info.server_status, self.status_info.failed_reason = server_status
289+
self.status_info.server_status, self.status_info.failed_reason = (
290+
server_status
291+
)
288292
return
289293

290294
if server_status == "RUNNING":

vec_inf/client/_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -153,8 +153,9 @@ def load_config() -> list[ModelConfig]:
153153
config.setdefault("models", {})[name] = data
154154
else:
155155
warnings.warn(
156-
f"WARNING: Could not find user config: {user_path}, revert to default config located at {default_path}", UserWarning,
157-
stacklevel=2
156+
f"WARNING: Could not find user config: {user_path}, revert to default config located at {default_path}",
157+
UserWarning,
158+
stacklevel=2,
158159
)
159160

160161
return [

vec_inf/client/api.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,6 @@ def shutdown_model(self, slurm_job_id: int) -> bool:
182182
raise SlurmJobError(f"Failed to shutdown model: {stderr}")
183183
return True
184184

185-
186185
def wait_until_ready(
187186
self,
188187
slurm_job_id: int,

0 commit comments

Comments
 (0)