It’s easy to forget about interactive sessions (Jupyter notebooks, RStudio) and accidentally leave them running, which can accrue unwanted charges or clog your computing resources. To prevent this, we’ve developed a customizable project using the Domino API and run scheduler to automatically shut down long-running sessions for you.
1. Log into https://app.dominodatalab.com/ and search for the project "ty/autoshutdown". Fork your own version of that project.
Note: If you're using a VPC or on-premise installation, reach out to our support team and we'll help you get access to the project on your system. Optionally, you can use the KB article for Moving a Project from one deployment to another.
2. In Settings, on the Access & Sharing tab, set your project to be private. This will ensure only you and those you invite have access to your project.
3. Take note of:
- the environment variable
DOMINO_USER_API_KEYto store your api key. This is handled automatically for you by Domino.
- The fact that this solution uses python, and also has two dependencies listed for pip in requirements.txt
4. The project mentioned herein contains an Jupyter interactive notebook with a bare bones test to stop a run manually. To use that test, you simply need a running session and its run ID. Once you have explored that, you can take a look at step 5.
shutdown.py script checks to see which runs have been running for longer than the threshold you set and shuts them down. Schedule
shutdown.py to run on a regular basis.
- Click Schedule on the menu on the left.
- Enter the command to run:
shutdown.py [project_owner] [project_name] [threshold_in_hours]
- Example would be shutdown.py johnjoo crimemaps 4, which tell the script to shut down any projects in johnjoo/crimemaps that have been running for more than 4 hours.
- A frequency of every day or every hour is pretty reasonable.