Skip to content

Commit 2aee819

Browse files
authored
fix: update user experience (#122)
* fix: update user experience * chore: code cleanup
1 parent b893a6b commit 2aee819

File tree

4 files changed

+461
-107
lines changed

4 files changed

+461
-107
lines changed

src/emd/cli.py

Lines changed: 26 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -1,32 +1,18 @@
11
import typer
2-
from rich.console import Console
3-
from rich.panel import Panel
4-
from typing import Optional
5-
from pathlib import Path
6-
import boto3
7-
from botocore.exceptions import ClientError, NoCredentialsError
8-
import time
9-
import os
10-
from enum import Enum
11-
import shutil
12-
import zipfile
13-
from emd.revision import VERSION, COMMIT_HASH
14-
152
from emd.commands import (
163
bootstrap,
174
deploy,
18-
# models,
5+
models,
196
destroy,
207
version,
218
status,
22-
config
9+
config,
10+
example
2311
)
2412
from emd.commands.invoke import invoke
25-
from emd.utils.aws_service_management import check_aws_environment
26-
from typing_extensions import Annotated
27-
from emd.utils.decorators import load_aws_profile,catch_aws_credential_errors
28-
from emd.models import Model
29-
import json
13+
from emd.revision import VERSION, COMMIT_HASH
14+
from rich.console import Console
15+
from rich.panel import Panel
3016

3117
app = typer.Typer(
3218
add_completion=False,
@@ -38,17 +24,17 @@
3824
app.add_typer(
3925
bootstrap.app,
4026
name="bootstrap",
41-
help="Set up AWS environment for model deployment",
27+
help="Initialize AWS resources for model deployment",
4228
)
4329
app.add_typer(
4430
deploy.app,
4531
name="deploy",
46-
help="Deploy a model",
32+
help="Deploy models to AWS infrastructure",
4733
)
4834
app.add_typer(
4935
status.app,
5036
name="status",
51-
help="Query model status",
37+
help="Display status of deployed models",
5238
)
5339

5440
# app.add_typer(
@@ -58,49 +44,37 @@
5844
# )
5945

6046
app.add_typer(
61-
destroy.app,
62-
name="destroy",
63-
help="Destroy a model deployment",
47+
invoke.app,
48+
name="invoke",
49+
help="Test deployed models with sample requests",
6450
)
6551

6652
app.add_typer(
67-
invoke.app,
68-
name="invoke",
69-
help="Invoke a model for testing, after deployment",
53+
example.app,
54+
name="example",
55+
help="Generate sample code for API integration",
56+
)
57+
58+
app.add_typer(
59+
destroy.app,
60+
name="destroy",
61+
help="Remove deployed models and clean up resources",
7062
)
7163

64+
app.add_typer(models.app, name="list-supported-models", help="Display available models")
65+
7266
app.add_typer(
7367
config.app,
74-
name="config",
75-
help="Set default config",
68+
name="profile",
69+
help="Configure AWS profile credentials",
7670
)
7771

7872
app.add_typer(
7973
version.app,
8074
name="version",
81-
help="Show version",
75+
help="Display tool version information",
8276
)
8377

84-
@app.command(help="List supported models")
85-
@catch_aws_credential_errors
86-
def list_supported_models(
87-
model_id: Annotated[
88-
str, typer.Argument(help="Model ID")
89-
] = None,
90-
detail: Annotated[
91-
Optional[bool],
92-
typer.Option("-a", "--detail", help="output model information in details.")
93-
] = False
94-
):
95-
# console.print("[bold blue]Retrieving models...[/bold blue]")
96-
support_models = Model.get_supported_models(detail=detail)
97-
if model_id:
98-
support_models = [model for _model_id,model in support_models.items() if _model_id == model_id]
99-
r = json.dumps(support_models,indent=2,ensure_ascii=False)
100-
print(f"{r}")
101-
102-
# app.add_typer(models.app, name="model",help="list supported models")
103-
10478
@app.callback(invoke_without_command=True)
10579
def callback(ctx: typer.Context):
10680
if ctx.invoked_subcommand is None:

0 commit comments

Comments
 (0)