Auto-shutdown for inactive dev environments—no idle GPUs¶
Whether you’re using cloud or on-prem compute, you may want to test your code before launching a
training task or deploying a service. dstack
’s dev environments
make this easy by setting up a remote machine, cloning your repository, and configuring your IDE —all within
a container that has GPU access.
One issue with dev environments is forgetting to stop them or closing your laptop, leaving the GPU idle and costly. With
our latest update, dstack
now detects inactive environments and automatically shuts them down, saving you money.
When defining a dev environment, you can now enable automatic shutdown by setting the
inactivity_duration
property to specify how long dstack
should wait before
automatically terminating an inactive environment.
type: dev-environment
# The name is optional, if not specified, generated randomly
name: vscode
python: "3.11"
ide: vscode
# Shut-down if inactive for 2 hours
inactivity_duration: 2h
resources:
gpu: 1
A dev environment is considered inactive when you close your desktop VS Code, exit any ssh <run name>
sessions, or
interrup the dstack apply
or dstack attach
command.
If you go offline without manually stopping anything, dstack
will
automatically detect inactivity and shut down the environment within approximately three minutes.
If you’ve configured inactivity_duration
, you can check how long a dev environment environment has been inactive using:
$ dstack ps --verbose
NAME BACKEND RESOURCES PRICE STATUS SUBMITTED
vscode cudo 2xCPU, 8GB, $0.0286 running 8 mins ago
100.0GB (disk) (inactive for 2m 34s)
Reattaching to the environment with dstack attach
resets the inactivity timer within seconds.
Overall, the new feature makes using dev environments both safer and more cost-effective. This not only helps reduce unnecessary GPU costs, but also ensures more efficient reuse of fleets by teams.
What's next?
- Check dev environments, tasks, services, and fleets
- Join Discord