-
Notifications
You must be signed in to change notification settings - Fork 11
Expand file tree
/
Copy pathendpoints.py
More file actions
48 lines (38 loc) · 1.21 KB
/
endpoints.py
File metadata and controls
48 lines (38 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
import click
from rich.console import Console
from rich.table import Table
from nucleus.deploy.cli.client import init_client
from nucleus.deploy.model_endpoint import AsyncModelEndpoint, Endpoint
@click.group("endpoints")
def endpoints():
"""Endpoints is a wrapper around model bundles in Scale Launch"""
@endpoints.command("list")
def list_endpoints():
"""List all of your Bundles"""
client = init_client()
table = Table(
"Endpoint name",
"Metadata",
"Endpoint type",
title="Endpoints",
title_justify="left",
)
for endpoint_sync_async in client.list_model_endpoints():
endpoint = endpoint_sync_async.endpoint
table.add_row(
endpoint.name,
endpoint.metadata,
endpoint.endpoint_type,
)
console = Console()
console.print(table)
@endpoints.command("delete")
@click.argument("endpoint_name")
def delete_bundle(endpoint_name):
"""Delete a model bundle"""
client = init_client()
console = Console()
endpoint = Endpoint(name=endpoint_name)
dummy_endpoint = AsyncModelEndpoint(endpoint=endpoint, client=client)
res = client.delete_model_endpoint(dummy_endpoint)
console.print(res)