Jupyter Server auto stop
Project description
stoy
Application for shutting down kernels in Jupyter Lab after they were idle for a specified period of time. The jupyter instance itself is terminated when no kernels were open for some time.
Usage
Add the following to on_start.sh script of your Sagemaker instance:
pip3 install stoy
export TOKEN=`generate-token`
echo -e '\nc.NotebookApp.token="'$TOKEN'"\n' >> /home/ec2-user/.jupyter/jupyter_notebook_config.py
stoy --kernel-idle=3600 --server-idle=1800 --token=$TOKEN --url="https://localhost:8443" --log="/var/log" &
generate-token is a script installed with stoy that uses uuid.uuid4 to generate a unique token. The token is saved in
an environment variable. The echo command adds the token to Jupyter notebook configuration file. Finally,
stoy is started as a background script and the token is passed to it.
Troubleshooting
The application saves logs in stoy.log located in the directory specified by the --log argument.
The default location is ~/.stoy/stoy.log.
To access the logs open jupyter lab terminal and run tail, for example:
tail -f /var/log/stoy.log
or
tail -f ~/.stoy/stoy.log
Use Control-C to stop watching the logs.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file stoy-0.0.16.tar.gz.
File metadata
- Download URL: stoy-0.0.16.tar.gz
- Upload date:
- Size: 5.2 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
de40a830a6d6e6ce0aa138034e3d33a6baa40899ce40dc4800ba531ccee3e9d5
|
|
| MD5 |
d691076a2f45c25afaedcc932dd3b8ce
|
|
| BLAKE2b-256 |
496085e1e81af4a30c9bc93481b916142a6e5d643365eadac5d001b6043622ee
|
File details
Details for the file stoy-0.0.16-py3-none-any.whl.
File metadata
- Download URL: stoy-0.0.16-py3-none-any.whl
- Upload date:
- Size: 5.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/3.8.0 pkginfo/1.8.2 readme-renderer/32.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.8 tqdm/4.62.3 importlib-metadata/4.11.1 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.5
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
fa23db9c98715b7f3c807273f0d3c23ccf57fa160aebf3dbfb6ba7461e96cc64
|
|
| MD5 |
60f45bfbe656f5bd336b89e880b38f21
|
|
| BLAKE2b-256 |
02e46ed48dbd5c1278c0705f4e81701dc30dc5696b96e6a164e8dab71cec4bee
|