Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

pre_spawn_hook not working #29

Open
belfhi opened this issue Jun 21, 2019 · 2 comments
Open

pre_spawn_hook not working #29

belfhi opened this issue Jun 21, 2019 · 2 comments

Comments

@belfhi
Copy link

belfhi commented Jun 21, 2019

Hello,
I want to use CondorSpawner to spawn notebooks on HTCondor.
For this I need to add a pre_spawn_hook to do some work so that the Kerberos
credentials are put into the spawner.environment properly.
When I use CondorSpawner directly the pre_spawn_hook executes and
spawning works.
With wrapspawner.ProfilesSpawner the pre_spawn_hook seems to execute (I added a log message) but spawning doesn't work because the environment in the spawner isn't set properly.
Is adding the pre_spawn_hook via c.Spawner.pre_spawn_hook = get_krb5_var
the right way of doing it or do I need to do it differently so that the hook is added to the child spawners?

@rkdarst
Copy link
Contributor

rkdarst commented Jun 21, 2019

It looks like pre_spawn_hook isn't relayed from WrapSpawner to the child spawner - this has been a problem with other attributes, too. I'd say, check out the way the start method works:
https://github.com/jupyterhub/wrapspawner/blob/master/wrapspawner/wrapspawner.py#L121
I think something like that should work with the pre_spawn_hook. I don't have time to make something right now, but you could try if you wanted.

Putting it on c.Spawner puts it on both (I think), but the one on ProfileSpawner doesn't update child spawner (I guess?) and the one on CondorSpawner doesn't get called at all. #27 would relay the attributes from ProfileSpawner to CondorSpawner, but I think that only gets set up when start is called, which happens after pre_spawn_hook gets called. But it gets harder...
if you set c.Spawner = your_hook, it would also override ProfileSpawner.pre_spawn_hook, which would mean it overrides the the child spawner construction and relaying the call. So I think the simplest thing to support is to only set c.CondorSpawner.pre_spawn_hook (and this should be documented).

Anything above could be wrong... but good luck for now! This will be important to have in general.

@belfhi
Copy link
Author

belfhi commented Jun 21, 2019

okay,
I will see if I can come up with something that can be turned into a pull request in the near future...
Thanks for the help for now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants