From 91039d1f338226b9c3dc3d68dd9677a1fc19e5f1 Mon Sep 17 00:00:00 2001
From: ale <ale@incal.net>
Date: Mon, 17 Mar 2025 12:12:34 +0000
Subject: [PATCH] Enable jupyterhub-idle-culler

---
 roles/jupyter/tasks/jupyter.yml | 22 ++++++++++++++++++++++
 1 file changed, 22 insertions(+)

diff --git a/roles/jupyter/tasks/jupyter.yml b/roles/jupyter/tasks/jupyter.yml
index 591661f..569029d 100644
--- a/roles/jupyter/tasks/jupyter.yml
+++ b/roles/jupyter/tasks/jupyter.yml
@@ -69,6 +69,28 @@
       # Configure the docker-based Spawner. The /home/joyvan path is what the Jupyter
       # Docker images use.
       c.JupyterHub.spawner_class = 'dockerspawner.DockerSpawner'
+      c.JupyterHub.load_roles = [
+        {
+          "name": "jupyterhub-idle-culler-role",
+          "scopes": [
+            "list:users",
+            "read:users:activity",
+            "read:servers",
+            "delete:servers",
+          ],
+          "services": ["jupyterhub-idle-culler-service"],
+        }
+      ]
+      c.JupyterHub.services = [
+        {
+          "name": "jupyterhub-idle-culler-service",
+          "command": [
+            sys.executable,
+            "-m", "jupyterhub_idle_culler",
+            "--timeout=3600",
+          ],
+        }
+      ]
       c.DockerSpawner.notebook_dir = '/home/jovyan/work'
       # This creates a volume for each user to store their notebooks. As an alternative,
       # we could bind-mount local filesystem paths (but something must create them first).
-- 
GitLab