-
Notifications
You must be signed in to change notification settings - Fork 308
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
Make it easier to pass custom env variables to kernel #981
Make it easier to pass custom env variables to kernel #981
Conversation
Hi @divyansshhh - This seems very similar to the Since you're using a custom When On a somewhat unrelated note, does anyone know what the UUID (placeholder?) is for, and does it correlate to something on the Lab side of things? |
Thanks for the recommendations, I'll try making a change to the FWIW, it seems the UUID was added to solve a race condition (as per this comment) |
In voila we used CGI variables, see e.g. https://github.com/voila-dashboards/voila/blob/main/voila/handler.py#L88 We could also add |
I tried the Thoughts on something like this? def get_kernel_env(self, path):
return {**os.environ, "JP_SESSION_NAME": path} To add extra env variabes (and make it easier to keep it in sync with upstream code) we can extend it's behavior in a custom session manager like this - # in a custom session manager
def get_kernel_env(self, path):
upstream_env = super().get_kernel_env()
return {**upstream_env, "EXTRA_ENV_VARIABLE": path_modified} |
Using a custom session manager, you're free to do anything you want, and this is probably the best approach for now. I think what is really necessary here is the ability to express parameters in general, and a formal kernel parameterization feature should include the ability to set arbitrary(?) envs (or perhaps those that are specified in the kernel parameter schema) along with whatever other parameters are published by the underlying kernel provisioner and kernel implementations. For example, |
392d5da
to
7dc6f8a
Compare
Codecov ReportBase: 72.59% // Head: 72.60% // Increases project coverage by
Additional details and impacted files@@ Coverage Diff @@
## main #981 +/- ##
=======================================
Coverage 72.59% 72.60%
=======================================
Files 64 64
Lines 8239 8242 +3
Branches 1378 1378
=======================================
+ Hits 5981 5984 +3
Misses 1844 1844
Partials 414 414
Help us with your feedback. Take ten seconds to tell us how you rate us. Have a feature suggestion? Share it here. ☔ View full report at Codecov. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for submitting this PR @divyansshhh. This seems like a reasonable step forward allowing custom session manager implementations to extend the env stanza.
@meeseeksdev please backport to 1.x |
Awww, sorry divyansshhh you do not seem to be allowed to do that, please ask a repository maintainer. |
Seems I can't use meeseeksdev. @kevin-bates can you please backport this to 1.x? Also, when is the next scheduled release of jupyter_server 1.x? It'd be nice to have a 1.x release with this commit by next Friday. |
@meeseeksdev please backport to 1.x |
Owee, I'm MrMeeseeks, Look at me. There seem to be a conflict, please backport manually. Here are approximate instructions:
And apply the correct labels and milestones. Congratulations — you did some good work! Hopefully your backport PR will be tested by the continuous integration and merged soon! Remember to remove the If these instructions are inaccurate, feel free to suggest an improvement. |
@divyansshhh, if you want to handle the manual backport I can make a 1.x release on Monday. We try not to release on Fridays in case we break things. 😄 |
I've raised #994 for the backport |
This is done to get the dir of the notebook where notebook initialising the kernel belongs.
#980