am I reading this correctly?
A Spawner starts each single-user notebook server. The Spawner represents an abstract interface to a process, and a custom Spawner needs to be able to take three actions: start a process, poll whet...
I have
c.Spawner.options_from_form = “simple”
c.Spawner.apply_user_options = {“dataset”: “dataset”}
and a form that returns
<select class="form-control" name="dataset" required autofocus>
should I get a variable user_options
manics
June 10, 2025, 1:53pm
2
apply_user_options
is used to set configurable Traitlets properties on the spawner. For example, in your case you’re trying to set Spawner.dataset
but spawners don’t have that property.
If you give us more information on what you’re trying to do we might be able to help.
1 Like
well I have got a lot farther.. now just accessing the options[‘dataset’] to link the correct directory.
from dockerspawner import DockerSpawner as Spawner
class MyCustomSpawner(Spawner):
def options_from_form(self, formdata):
options = {}
options[‘image’] = formdata.get(‘image’, [‘’])[0]
options[‘dataset’] = formdata.get(‘dataset’, [‘’])[0]
return options
async def start(self):
image = self.user_options.get('image')
dataset = self.user_options.get('dataset')
return await super().start() # Call parent's start method
async def stop(self):
return await super().stop()
async def poll(self):
return await super().poll()
c.JupyterHub.spawner_class = MyCustomSpawner