R
Runpod11mo ago
rachel

Configure pod to auto stop/auto delete once the container's main process exits?

Hi everyone! I've been trying out Fly.io for GPU stuff a bit, and I absolutely love the workflow of being able to build and push a container of whatever I'm working on, and have it automatically de-provision the container once my training process exits and finishes uploading artifacts. This is really nice as it lets me easily run as many tasks as I want on separate GPUs without having to worry about manually stopping them. However, I much prefer Runpod as a platform (and much prefer runpod's pricing as well) and I want to replicate the same workflow here. Is there a good way to do that? I did some testing and it appears that if my main process exits the pod just restarts.
2 Replies
flash-singh
flash-singh11mo ago
you can use runpodctl to stop the pod and you don't need api key for this since inside the pod, limited scoped api key is already injected this is not testted but hopefully help guide you e.g
bash -c 'sleep 10; runpodctl stop pod $RUNPOD_POD_ID'
bash -c 'sleep 10; runpodctl stop pod $RUNPOD_POD_ID'
above command will sleep for 10s then use runpodctl to stop the pod, RUNPOD_POD_ID is the env variable that we auto populate, RUNPOD_API_KEY is auto populated by us in all pods with limited scope to the pod itself plesae test before making use of it
Unknown User
Unknown User11mo ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?