Skip to content

[Serve] Return service name and endpoint from sky.serve.up #3546

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 6 commits into from
May 16, 2024
Merged
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
10 changes: 8 additions & 2 deletions sky/serve/core.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
"""SkyServe core APIs."""
import re
import tempfile
from typing import Any, Dict, List, Optional, Union
from typing import Any, Dict, List, Optional, Tuple, Union

import colorama

Expand Down Expand Up @@ -94,14 +94,19 @@ def _validate_service_task(task: 'sky.Task') -> None:
def up(
task: 'sky.Task',
service_name: Optional[str] = None,
) -> None:
) -> Tuple[str, str]:
"""Spin up a service.

Please refer to the sky.cli.serve_up for the document.

Args:
task: sky.Task to serve up.
service_name: Name of the service.

Returns:
service_name: str; The name of the service. Same if passed in as an
argument.
endpoint: str; The service endpoint.
"""
if service_name is None:
service_name = serve_utils.generate_service_name()
Expand Down Expand Up @@ -292,6 +297,7 @@ def up(
f'{style.RESET_ALL}'
f'\n{fore.GREEN}The replicas should be ready within a '
f'short time.{style.RESET_ALL}')
return service_name, endpoint


@usage_lib.entrypoint
Expand Down
Loading