jupyterhub / wrapspawner

Mechanism for runtime configuration of spawners for JupyterHub
BSD 3-Clause "New" or "Revised" License
60 stars 57 forks source link

Child spawner cmd overridden #30

Open rcthomas opened 5 years ago

rcthomas commented 5 years ago

I was a bit late to the party to test #27; I have a WrapSpawner implementation that has a custom cmd in the child profiles, and they are now getting overridden by c.Spawner.cmd. I have a profilespawner-like setup and the spawn command is different on different profiles.

Could we modify the directional link logic so that traits set and explicitly passed to the child spawner constructor aren't linked maybe? I can experiment with it next week.

rkdarst commented 5 years ago

How are you setting cmd overall, are you setting anything directly on a c.Spawner also? I'm also setting a cmd in ProfileSpawner using the overrides and no where else, and it seems to still work.

rcthomas commented 5 years ago

Indeed I'd been setting c.Spawner.cmd and then in the profile setting cmd to something else. If I leave it alone and only set cmd in the profiles then it's OK. I haven't looked into the logic behind the trait values and directional link but I guess traitlets knows if the value's been changed from the default in WrapSpawner (c.Spawner). That was a surprise, we thought what should happen would be a child spawner value would be overridden by the profile regardless of whether the parent had been set in the config by us.

cexen commented 4 years ago

Hello, I encountered a similar issue. For me, notebook_dir and disable_user_config in profiles had no effect on the child spawner.

This is an issue related to #27. By experiment, I confirmed that the directional_link setting overwrites the trait value of self.child_spawner with that of self.

I've created a small PR #39 that restores the overwritten values with a naive approach. I'm not familiar with traitlets; There might be more elegant ways.

Aethylred commented 3 years ago

I have a WrapSpawner implementation that has a custom cmd in the child profiles

Can you please post an example of this? We're looking at a use case where the spawner chooses to launch custom binary.

rcthomas commented 3 years ago

@Aethylred Have a look at the ProfilesSpawner example in the README; you just need to add cmd: "whatever" to the dict being passed there.