mirror of
https://github.com/jupyterhub/the-littlest-jupyterhub.git
synced 2025-12-18 21:54:05 +08:00
Explain how we contruct the spawner
This commit is contained in:
@@ -35,7 +35,11 @@ class CustomSpawner(SystemdSpawner):
|
|||||||
return super().start()
|
return super().start()
|
||||||
|
|
||||||
cfg = configurer.load_config()
|
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']:
|
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), {})
|
UserCreatingSpawner = type('UserCreatingSpawner', (ConfiguratorSpawnerMixin, CustomSpawner), {})
|
||||||
else:
|
else:
|
||||||
UserCreatingSpawner = type('UserCreatingSpawner', (CustomSpawner,), {})
|
UserCreatingSpawner = type('UserCreatingSpawner', (CustomSpawner,), {})
|
||||||
|
|||||||
Reference in New Issue
Block a user