Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/zenml/cli/deployment.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,7 @@ def provision_deployment(
dashboard_url = get_deployment_url(deployment)
if dashboard_url:
cli_utils.declare(
f"\n✅ [bold green]View in ZenML Cloud:[/bold green] "
f"[link]{dashboard_url}[/link]"
f"\nView in ZenML Cloud: [link]{dashboard_url}[/link]"
)


Expand Down
6 changes: 2 additions & 4 deletions src/zenml/cli/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -491,8 +491,7 @@ def deploy_pipeline(
dashboard_url = get_deployment_url(deployment)
if dashboard_url:
cli_utils.declare(
f"\n✅ [bold green]View in the ZenML UI:[/bold green] "
f"[link]{dashboard_url}[/link]"
f"\nView in the ZenML UI: [link]{dashboard_url}[/link]"
)

if attach:
Expand Down Expand Up @@ -1242,8 +1241,7 @@ def deploy_snapshot(
dashboard_url = get_deployment_url(deployment)
if dashboard_url:
cli_utils.declare(
f"\n✅ [bold green]View in the ZenML UI:[/bold green] "
f"[link]{dashboard_url}[/link]"
f"\nView in the ZenML UI: [link]{dashboard_url}[/link]"
)


Expand Down
74 changes: 32 additions & 42 deletions src/zenml/cli/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2494,10 +2494,10 @@ def pretty_print_deployment(
no_truncate: Whether to truncate the metadata.
"""
# Header section
status = format_deployment_status(deployment.status)
status_label = (deployment.status or "UNKNOWN").upper()
status_emoji = get_deployment_status_emoji(deployment.status)
declare(
f"\n🚀 Deployment: [bold cyan]{deployment.name}[/bold cyan] is: {status} {status_emoji}"
f"\n[bold]Deployment:[/bold] [bold cyan]{deployment.name}[/bold cyan] status: {status_label} {status_emoji}"
)
if deployment.snapshot is None:
pipeline_name = "N/A"
Expand All @@ -2515,7 +2515,7 @@ def pretty_print_deployment(

# Connection section
if deployment.url:
declare("\n📡 [bold]Connection Information:[/bold]")
declare("\n[bold]Connection information:[/bold]")

declare(f"\n[bold]Endpoint URL:[/bold] [link]{deployment.url}[/link]")
declare(
Expand All @@ -2526,15 +2526,14 @@ def pretty_print_deployment(
auth_key = deployment.auth_key
if auth_key:
if show_secret:
declare(f"[bold]Auth Key:[/bold] [yellow]{auth_key}[/yellow]")
declare(f"[bold]Auth key:[/bold] [yellow]{auth_key}[/yellow]")
else:
masked_key = (
f"{auth_key[:8]}***" if len(auth_key) > 8 else "***"
)
declare(
f"[bold]Auth Key:[/bold] [yellow]{masked_key}[/yellow] "
f"[dim](run [green]`zenml deployment describe {deployment.name} "
"--show-secret`[/green] to reveal)[/dim]"
f"[bold]Auth key:[/bold] [yellow]{masked_key}[/yellow] "
f"[dim](run `zenml deployment describe {deployment.name} --show-secret` to reveal)[/dim]"
)

example = get_deployment_invocation_example(deployment)
Expand All @@ -2553,11 +2552,11 @@ def pretty_print_deployment(
)
cli_command = f"zenml deployment invoke {deployment.name} {cli_args}"

declare("[bold]CLI Command Example:[/bold]")
console.print(f"[green]{cli_command}[/green]")
declare("[bold]CLI command example:[/bold]")
console.print(cli_command)

# cURL example
declare("\n[bold]cURL Example:[/bold]")
declare("\n[bold]cURL example:[/bold]")
curl_headers = []
if auth_key:
if show_secret:
Expand All @@ -2578,21 +2577,23 @@ def pretty_print_deployment(
"parameters": {curl_params}
}}'"""

console.print(f"[green]{curl_command}[/green]")
console.print(curl_command)

# JSON Schemas
if show_schema:
input_schema = get_deployment_input_schema(deployment)
output_schema = get_deployment_output_schema(deployment)
declare("\n📋 [bold]Deployment JSON Schemas:[/bold]")
declare("\n[bold]Input Schema:[/bold]")
declare("\n[bold]Deployment JSON schemas:[/bold]")
declare("\n[bold]Input schema:[/bold]")
schema_json = json.dumps(input_schema, indent=2)
console.print(f"[green]{schema_json}[/green]")
declare("\n[bold]Output Schema:[/bold]")
console.print(schema_json)
declare("\n[bold]Output schema:[/bold]")
schema_json = json.dumps(output_schema, indent=2)
console.print(f"[green]{schema_json}[/green]")
console.print(schema_json)

# Metadata section
if show_metadata:
declare("\n📋 [bold]Deployment Metadata[/bold]")
declare("\n[bold]Deployment metadata:[/bold]")

# Get the metadata - it could be from deployment_metadata property or metadata
metadata = deployment.deployment_metadata
Expand All @@ -2603,7 +2604,7 @@ def format_value(value: Any, indent_level: int = 0) -> str:
if isinstance(value, dict):
if not value:
return "[dim]{}[/dim]"
formatted_items = []
formatted_items: List[str] = []
for k, v in value.items():
formatted_v = format_value(v, indent_level + 1)
formatted_items.append(
Expand Down Expand Up @@ -2640,34 +2641,23 @@ def format_value(value: Any, indent_level: int = 0) -> str:
declare(" [dim]No metadata available[/dim]")

# Management section
declare("\n⚙️ [bold]Management Commands[/bold]")
declare("\n[bold]Management commands[/bold]\n")

mgmt_table = table.Table(
box=box.ROUNDED,
show_header=False,
border_style="dim",
padding=(0, 1),
)
mgmt_table.add_column("Command", style="bold")
mgmt_table.add_column("Description")
console.print(f"[bold]zenml deployment logs {deployment.name} -f[/bold]")
console.print(" [dim]Follow deployment logs in real time[/dim]\n")

mgmt_table.add_row(
f"zenml deployment logs {deployment.name} -f",
"Follow deployment logs in real-time",
)
mgmt_table.add_row(
f"zenml deployment describe {deployment.name}",
"Show detailed deployment information",
)
mgmt_table.add_row(
f"zenml deployment deprovision {deployment.name}",
"Deprovision this deployment and keep a record of it",
console.print(f"[bold]zenml deployment describe {deployment.name}[/bold]")
console.print(" [dim]Show detailed deployment information[/dim]\n")

console.print(
f"[bold]zenml deployment deprovision {deployment.name}[/bold]"
)
mgmt_table.add_row(
f"zenml deployment delete {deployment.name}",
"Deprovision and delete this deployment",
console.print(
" [dim]Deprovision this deployment and keep a record of it[/dim]\n"
)
console.print(mgmt_table)

console.print(f"[bold]zenml deployment delete {deployment.name}[/bold]")
console.print(" [dim]Deprovision and delete this deployment[/dim]")


def check_zenml_pro_project_availability() -> None:
Expand Down
Loading