This repository was archived by the owner on May 22, 2025. It is now read-only.
This repository was archived by the owner on May 22, 2025. It is now read-only.
auto-stop-idle/autostop.py ignores open terminal sessions #90
Open
Description
Bug:
When JupyterLab is open, but terminal sessions are used instead of notebook sessions, instance may get incorrectly shut down despite being actively used.
Debug:
- autostop.py uses
sessions
API: https://github.com/aws-samples/amazon-sagemaker-notebook-instance-lifecycle-config-samples/blob/master/scripts/auto-stop-idle/autostop.py#L88 - Jupyter exposes info about notebooks and terminals under separate APIs:
- https://jupyter-server.readthedocs.io/en/latest/developers/rest-api.html#get--api-sessions-session for notebook sessions
- https://jupyter-server.readthedocs.io/en/latest/developers/rest-api.html#get--api-terminals-terminal_id for terminals
- Activity on terminal never gets picked up by autostop.py which may result in premature shutdown
Caveats:
- Newer Jupyter versions expose last activity timestamp in terminal API
- Version available currently in AWS od not expose this information
From my manual check 5 minutes ago:
sh-4.2$ curl -k https://localhost:8443/api/terminals/1
{"name": "1"}sh-4.2$
Metadata
Metadata
Assignees
Labels
No labels