From 4fc26bc5ef1ffcbcf0aa31e408962b0f620d8ee0 Mon Sep 17 00:00:00 2001 From: GeorgianaElena Date: Tue, 6 Apr 2021 14:00:28 +0300 Subject: [PATCH] Explain how we contruct the spawner --- tljh/user_creating_spawner.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tljh/user_creating_spawner.py b/tljh/user_creating_spawner.py index 14307f0..6490596 100755 --- a/tljh/user_creating_spawner.py +++ b/tljh/user_creating_spawner.py @@ -35,7 +35,11 @@ class CustomSpawner(SystemdSpawner): return super().start() cfg = configurer.load_config() +# Use the jupyterhub-configurator mixin only if configurator is enabled +# otherwise, any bugs in the configurator backend will stop new user spawns! if cfg['services']['configurator']['enabled']: + # Dynamically create the Spawner class using `type`(https://docs.python.org/3/library/functions.html?#type), + # based on whether or not it should inherit from ConfiguratorSpawnerMixin UserCreatingSpawner = type('UserCreatingSpawner', (ConfiguratorSpawnerMixin, CustomSpawner), {}) else: UserCreatingSpawner = type('UserCreatingSpawner', (CustomSpawner,), {})