-
We have workspaces where no client is connected to, but which are executing some long-running tasks, like some multiple-hours of cpu or gpu usage. The autostop feature looks at activity as being a session connected to a workspace, either ssh, vscode, etc. However, the long-running processes are daemonized/background tasks, or simply running in a tmux/screen process, and a sessions isn't needed during the processing, as the engineer will move on to do other tasks on other workspaces. I would ask for either a way to include a threshold of cpu/gpu usage as activity, or even some way to run a script and report activity (upon request from coder, or as a daemon) ourselves, being some kind of a "ping, i'm still active and doing something"-api call, that will signal to coder to bump the autostop timer... Once the cpu/gpu task is finished, the autostop feature can kick in and stop the workspace as normal... |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 1 reply
-
Hi @wonko, you can programmatically extend a workspace's deadline using the following API endpoint |
Beta Was this translation helpful? Give feedback.
-
This "deadline" concept isn't mentioned anywhere in the docs, beside the API reference. Will this override the autostop mechanism until the set date/time? How do I remove this once the task is done (set a negative time? ...)... |
Beta Was this translation helpful? Give feedback.
-
Perfect, thanks, we will be trying that out. Documentation of the API calls could be improved, btw, as I had looked at that function, but thought it did something else... |
Beta Was this translation helpful? Give feedback.
This sets a new deadline. You can use it as part of a script that keeps bumping the deadline by setting it, say, 1 hour in the future until the script is running. When the script completes, this will not be called anymore, so the workspace would auto-stop reaching its deadline.