Skip to content

Commit 919f724

Browse files
committed
Extract _get_service_url_renderable
1 parent ed2d9d8 commit 919f724

File tree

2 files changed

+7
-3
lines changed
  • src
    • dstack/_internal/cli/services/configurators
    • tests/_internal/cli/services/configurators

2 files changed

+7
-3
lines changed

src/dstack/_internal/cli/services/configurators/run.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -802,7 +802,7 @@ def _detect_windsurf_version(exe: str = "windsurf") -> Optional[str]:
802802
def _print_service_urls(run: Run) -> None:
803803
if run._run.run_spec.configuration.type != RunConfigurationType.SERVICE.value:
804804
return
805-
console.print(f"Service is published at:\n [link={run.service_url}]{run.service_url}[/]")
805+
console.print(_get_service_url_renderable(run))
806806
if model := run.service_model:
807807
console.print(
808808
f"Model [code]{model.name}[/] is published at:\n [link={model.url}]{model.url}[/]"
@@ -820,7 +820,7 @@ def _get_apply_status(run: Run) -> str:
820820
def _get_apply_wait_renderables(run: Run) -> list[str]:
821821
wait_status = get_run_wait_status(run._run)
822822
if wait_status is RunWaitStatus.WAITING_FOR_REQUESTS and run._run.service is not None:
823-
return [f"Service URL: [link={run.service_url}]{run.service_url}[/]"]
823+
return [_get_service_url_renderable(run)]
824824
if (
825825
wait_status is RunWaitStatus.WAITING_FOR_SCHEDULE
826826
and run._run.next_triggered_at is not None
@@ -830,6 +830,10 @@ def _get_apply_wait_renderables(run: Run) -> list[str]:
830830
return []
831831

832832

833+
def _get_service_url_renderable(run: Run) -> str:
834+
return f"Service is published at:\n [link={run.service_url}]{run.service_url}[/]"
835+
836+
833837
def _print_dev_environment_connection_info(run: Run) -> None:
834838
if not FeatureFlags.CLI_PRINT_JOB_CONNECTION_INFO:
835839
return

src/tests/_internal/cli/services/configurators/test_run.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -460,7 +460,7 @@ async def test_waiting_for_requests_status_and_renderables(self, session):
460460

461461
assert _get_apply_status(api_run) == "[code]service-run[/] is waiting for requests..."
462462
assert _get_apply_wait_renderables(api_run) == [
463-
"Service URL: [link=http://127.0.0.1:3000/proxy/services/test/service-run/]http://127.0.0.1:3000/proxy/services/test/service-run/[/]"
463+
"Service is published at:\n [link=http://127.0.0.1:3000/proxy/services/test/service-run/]http://127.0.0.1:3000/proxy/services/test/service-run/[/]"
464464
]
465465

466466
async def test_waiting_for_schedule_status_and_renderables(self, session):

0 commit comments

Comments
 (0)