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
10 changes: 9 additions & 1 deletion src/dstack/_internal/cli/services/configurators/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -208,14 +208,16 @@ def apply_configuration(
# We can attach to run multiple times if it goes from running to pending (retried).
while True:
with MultiItemStatus(_get_apply_status(run), console=console) as live:
ready_wait_attempt = 0
while not _is_ready_to_attach(run):
table = get_runs_table([run])
live.update(
table,
*_get_apply_wait_renderables(run),
status=_get_apply_status(run),
)
time.sleep(5)
time.sleep(_get_ready_wait_interval(ready_wait_attempt))
ready_wait_attempt += 1
run.refresh()

console.print(
Expand Down Expand Up @@ -724,6 +726,12 @@ def apply_args(self, conf: TaskConfiguration, args: argparse.Namespace):
self.apply_commands_args(conf, args)


def _get_ready_wait_interval(attempt: int) -> float:
if attempt < 5:
return 1
return 5


def _merge_ports(conf: List[PortMapping], args: List[PortMapping]) -> Dict[int, PortMapping]:
_unique_ports_constraint([pm.container_port for pm in conf])
_unique_ports_constraint([pm.container_port for pm in args])
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@
from dstack._internal.server.services.jobs.configurators.base import JobConfigurator

INSTALL_IPYKERNEL = (
"(echo 'uv pip install ipykernel...' && uv pip install -q --no-cache-dir ipykernel 2> /dev/null) || "
"(echo 'pip install ipykernel...' && pip install -q --no-cache-dir ipykernel 2> /dev/null) || "
"echo 'no pip, ipykernel was not installed'"
"echo 'no uv or pip found, ipykernel was not installed'"
)


Expand Down
24 changes: 16 additions & 8 deletions src/tests/_internal/server/routers/test_runs.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,9 +110,11 @@ def get_dev_env_run_plan_dict(
"-c",
(
"start-dockerd"
" && (echo 'pip install ipykernel...'"
" && (echo 'uv pip install ipykernel...'"
" && uv pip install -q --no-cache-dir ipykernel 2> /dev/null)"
" || (echo 'pip install ipykernel...'"
" && pip install -q --no-cache-dir ipykernel 2> /dev/null)"
" || echo 'no pip, ipykernel was not installed'"
" || echo 'no uv or pip found, ipykernel was not installed'"
" && echo"
" && echo 'To open in VS Code, use link below:'"
" && echo"
Expand All @@ -137,9 +139,11 @@ def get_dev_env_run_plan_dict(
" && sudo chown $(id -u):$(id -g) $DSTACK_VENV_DIR"
" && uv venv -q --prompt dstack -p 3.13 --seed $DSTACK_VENV_DIR"
" && eval $(echo '. $DSTACK_VENV_DIR/bin/activate' | sudo tee -a /dstack/profile)"
" && (echo 'pip install ipykernel...'"
" && (echo 'uv pip install ipykernel...'"
" && uv pip install -q --no-cache-dir ipykernel 2> /dev/null)"
" || (echo 'pip install ipykernel...'"
" && pip install -q --no-cache-dir ipykernel 2> /dev/null)"
" || echo 'no pip, ipykernel was not installed'"
" || echo 'no uv or pip found, ipykernel was not installed'"
" && echo"
" && echo 'To open in VS Code, use link below:'"
" && echo"
Expand Down Expand Up @@ -348,9 +352,11 @@ def get_dev_env_run_dict(
"-c",
(
"start-dockerd"
" && (echo 'pip install ipykernel...'"
" && (echo 'uv pip install ipykernel...'"
" && uv pip install -q --no-cache-dir ipykernel 2> /dev/null)"
" || (echo 'pip install ipykernel...'"
" && pip install -q --no-cache-dir ipykernel 2> /dev/null)"
" || echo 'no pip, ipykernel was not installed'"
" || echo 'no uv or pip found, ipykernel was not installed'"
" && echo"
" && echo 'To open in VS Code, use link below:'"
" && echo"
Expand All @@ -375,9 +381,11 @@ def get_dev_env_run_dict(
" && sudo chown $(id -u):$(id -g) $DSTACK_VENV_DIR"
" && uv venv -q --prompt dstack -p 3.13 --seed $DSTACK_VENV_DIR"
" && eval $(echo '. $DSTACK_VENV_DIR/bin/activate' | sudo tee -a /dstack/profile)"
" && (echo 'pip install ipykernel...'"
" && (echo 'uv pip install ipykernel...'"
" && uv pip install -q --no-cache-dir ipykernel 2> /dev/null)"
" || (echo 'pip install ipykernel...'"
" && pip install -q --no-cache-dir ipykernel 2> /dev/null)"
" || echo 'no pip, ipykernel was not installed'"
" || echo 'no uv or pip found, ipykernel was not installed'"
" && echo"
" && echo 'To open in VS Code, use link below:'"
" && echo"
Expand Down
Loading