Explain how we contruct the spawner

This commit is contained in:
GeorgianaElena
2021-04-06 14:00:28 +03:00
parent 0e7c30296d
commit 4fc26bc5ef

View File

@@ -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,), {})