Skip to main content

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.

Release files for stoy 0.0.16

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for stoy 0.0.16
File Size Uploaded
stoy-0.0.16.tar.gz 5.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for stoy 0.0.16
File Interpreter ABI Platform
stoy-0.0.16-py3-none-any.whl Python 3 none any Details

Total release size: 10.9 kB

Release files / stoy-0.0.16.tar.gz

Download URL stoy-0.0.16.tar.gz
Size 5.2 kB
Tags Source
SHA-256 checksum
How to use checksums
de40a830a6d6e6ce0aa138034e3d33a6baa40899ce40dc4800ba531ccee3e9d5
BLAKE2b-256 checksum
How to use checksums
496085e1e81af4a30c9bc93481b916142a6e5d643365eadac5d001b6043622ee
Upload date
Uploaded using Trusted Publishing?
What is 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

Release files / stoy-0.0.16-py3-none-any.whl

Download URL stoy-0.0.16-py3-none-any.whl
Size 5.7 kB
Tags Python 3
SHA-256 checksum
How to use checksums
fa23db9c98715b7f3c807273f0d3c23ccf57fa160aebf3dbfb6ba7461e96cc64
BLAKE2b-256 checksum
How to use checksums
02e46ed48dbd5c1278c0705f4e81701dc30dc5696b96e6a164e8dab71cec4bee
Upload date
Uploaded using Trusted Publishing?
What is 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

Release history Release notifications | RSS feed

This release

0.0.16 This release

2 release files

0.0.12

2 release files

0.0.11

2 release files

0.0.10

2 release files

0.0.9

2 release files

0.0.8

2 release files

0.0.7

2 release files

0.0.6

2 release files

0.0.5

2 release files

0.0.4

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page