wrapspawner icon indicating copy to clipboard operation
wrapspawner copied to clipboard

Child spawner cmd overridden

Open rcthomas opened this issue 5 years ago • 5 comments

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.

rcthomas avatar Jun 21 '19 13:06 rcthomas

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.

rkdarst avatar Jun 24 '19 06:06 rkdarst

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.

rcthomas avatar Jun 25 '19 16:06 rcthomas

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.

cexen avatar May 15 '20 12:05 cexen

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.

Aethylred avatar Apr 16 '21 01:04 Aethylred

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

rcthomas avatar Apr 16 '21 14:04 rcthomas