You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@airavata.apache.org by la...@apache.org on 2024/12/02 06:08:24 UTC
(airavata) branch agent-framewok-refactoring updated: Terminate idle notebook containers
This is an automated email from the ASF dual-hosted git repository.
lahirujayathilake pushed a commit to branch agent-framewok-refactoring
in repository https://gitbox.apache.org/repos/asf/airavata.git
The following commit(s) were added to refs/heads/agent-framewok-refactoring by this push:
new 93421fa5bf Terminate idle notebook containers
93421fa5bf is described below
commit 93421fa5bf9c66893824078427bd5f438f7d77ac
Author: lahiruj <la...@gmail.com>
AuthorDate: Mon Dec 2 01:08:17 2024 -0500
Terminate idle notebook containers
---
dev-tools/deployment/jupyterhub/Dockerfile | 2 +-
.../deployment/jupyterhub/jupyterhub_config.py | 23 ++++++++++++++++++++++
2 files changed, 24 insertions(+), 1 deletion(-)
diff --git a/dev-tools/deployment/jupyterhub/Dockerfile b/dev-tools/deployment/jupyterhub/Dockerfile
index 8b517dca34..c34d9d453d 100644
--- a/dev-tools/deployment/jupyterhub/Dockerfile
+++ b/dev-tools/deployment/jupyterhub/Dockerfile
@@ -1,6 +1,6 @@
FROM jupyterhub/jupyterhub:3.0
-RUN pip install oauthenticator requests pyjwt dockerspawner
+RUN pip install oauthenticator requests pyjwt dockerspawner jupyterhub-idle-culler
COPY jupyterhub_config.py /srv/jupyterhub/jupyterhub_config.py
diff --git a/dev-tools/deployment/jupyterhub/jupyterhub_config.py b/dev-tools/deployment/jupyterhub/jupyterhub_config.py
index f7e8e127c3..e37b7e0e90 100644
--- a/dev-tools/deployment/jupyterhub/jupyterhub_config.py
+++ b/dev-tools/deployment/jupyterhub/jupyterhub_config.py
@@ -1,5 +1,6 @@
from oauthenticator.generic import GenericOAuthenticator
import os
+import sys
# Authenticator Configuration
c.JupyterHub.authenticator_class = GenericOAuthenticator
@@ -39,3 +40,25 @@ c.JupyterHub.hub_connect_ip = 'jupyterhub'
# Logging
c.JupyterHub.log_level = 'DEBUG'
+
+# Terminate idle notebook containers
+c.JupyterHub.services = [
+ {
+ "name": "jupyterhub-idle-culler-service",
+ "admin": True,
+ "command": [sys.executable, "-m", "jupyterhub_idle_culler", "--timeout=3600"],
+ }
+]
+
+c.JupyterHub.load_roles = [
+ {
+ "name": "jupyterhub-idle-culler-role",
+ "scopes": [
+ "list:users",
+ "read:users:activity",
+ "read:servers",
+ "delete:servers",
+ ],
+ "services": ["jupyterhub-idle-culler-service"],
+ }
+]