Skip to content

Commit 4c5525f

Browse files
[Docs] Inactive duration blog post
1 parent babb0c4 commit 4c5525f

1 file changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
---
2+
title: Auto-shutdown for inactive dev environments—no idle GPUs
3+
date: 2025-02-19
4+
description: "dstack introduces a new feature that automatically detects and shuts down inactive dev environments, helping you avoid wasted GPU costs."
5+
slug: inactive-dev-environments-auto-shutdown
6+
image: https://github.com/dstackai/static-assets/blob/main/static-assets/images/inactive-dev-environments-auto-shutdown.png?raw=true
7+
categories:
8+
- Dev environments
9+
---
10+
11+
# Auto-shutdown for inactive dev environments—no idle GPUs
12+
13+
Whether you’re using cloud or on-prem compute, you may want to test your code before launching a
14+
training task or deploying a service. `dstack`’s [dev environments](../../docs/concepts/dev-environments.md)
15+
make this easy by setting up a remote machine, cloning your repository, and configuring your IDE —all within
16+
a container that has GPU access.
17+
18+
One issue with dev environments is forgetting to stop them or closing your laptop, leaving the GPU idle and costly. With
19+
our latest update, `dstack` now detects inactive environments and automatically shuts them down, saving you money.
20+
21+
<img src="https://github.com/dstackai/static-assets/blob/main/static-assets/images/inactive-dev-environments-auto-shutdown.png?raw=true" width="630"/>
22+
23+
<!-- more -->
24+
25+
When defining a dev environment, you can now enable automatic shutdown by setting the
26+
`inactivity_duration` property to specify how long `dstack` should wait before
27+
automatically terminating an inactive environment.
28+
29+
```yaml
30+
type: dev-environment
31+
# The name is optional, if not specified, generated randomly
32+
name: vscode
33+
34+
python: "3.11"
35+
36+
ide: vscode
37+
38+
# Shut-down if inactive for 2 hours
39+
inactivity_duration: 2h
40+
41+
resources:
42+
gpu: 1
43+
```
44+
45+
A dev environment is considered inactive when you close your desktop VS Code, exit any `ssh <run name>` sessions, or
46+
interrup the `dstack apply` or `dstack attach` command.
47+
48+
If you go offline without manually stopping anything, `dstack` will
49+
automatically detect inactivity and shut down the environment within approximately three minutes.
50+
51+
If you’ve configured `inactivity_duration`, you can check how long a dev environment environment has been inactive using:
52+
53+
<div class="termy">
54+
55+
```shell
56+
$ dstack ps --verbose
57+
NAME BACKEND RESOURCES PRICE STATUS SUBMITTED
58+
vscode cudo 2xCPU, 8GB, $0.0286 running 8 mins ago
59+
100.0GB (disk) (inactive for 2m 34s)
60+
```
61+
62+
</div>
63+
64+
Reattaching to the environment with [`dstack attach`](../../docs/reference/cli/dstack/attach.md),
65+
resets the inactivity timer within seconds.
66+
67+
Overall, the new feature makes using dev environments both safer and more cost-effective.
68+
This not only helps reduce unnecessary GPU costs, but also ensures more efficient reuse of
69+
fleets by teams.
70+
71+
!!! info "What's next?"
72+
1. Check [dev environments](../../docs/concepts/dev-environments.md),
73+
[tasks](../../docs/concepts/tasks.md), [services](../../docs/concepts/services.md),
74+
and [fleets](../../docs/concepts/fleets.md)
75+
2. Join [Discord :material-arrow-top-right-thin:{ .external }](https://discord.gg/u8SmfwPpMd){:target="_blank"}

0 commit comments

Comments
 (0)