jupyter-server-proxy icon indicating copy to clipboard operation
jupyter-server-proxy copied to clipboard

Passing notebook work directory and token to SupervisedProcess

Open oeway opened this issue 4 years ago • 4 comments

Hi, we are working on a file browser (https://github.com/imjoy-team/jupyter-elfinder) for managing files on remote servers.

Because it's specifically designed to work with jupyter server, we would like to access more env variables (e.g.: notebook work directory and token).

It seems there is no way to access those variables currently. Is there any consideration for not doing so? Otherwise, I am happy to make a PR.

We need to also consider:

  1. where should we expose those variables, via environment variables (SuperviseAndProxyHandler.get_env) or process arguments (config.process_args)

  2. which are the variables to expose ? For my application, I need the work dir of notebook server (web_app.settings["server_root_dir"])and the token (web_app.settings["token"]).

  3. should we always set the cwd for launching supervised processes the same as notebook work directory?

oeway avatar Mar 15 '20 10:03 oeway

Have you thought about writing your own proxy that subclasses jupyter-server-proxy, or alternatively integrating the browser as a jupyter extension? If you require the notebook token it sounds like you're making API requests, so this might be easier?

manics avatar Apr 04 '20 16:04 manics

@manics Thanks for the suggestions.

Normally, we won't need the notebook token for the web page to make request to the proxied server (because authentication will be done automatically via the xsrf cookies), however, in some cases, when we need to make request from a webworker or a page hosted from another domain, we cannot use the cookies and without a token the request won't pass the proxy.

So I think this feature is not too specific to our project, be can be useful for those cases for other project as well.

Sure we can make a different package for supporting these, obviously that's not ideal if this can be considered here.

oeway avatar Apr 05 '20 10:04 oeway

@oeway did you manage to get this working with a subclass? If so, we can see what needed to be changed there, and possibly bring it back upstream.

yuvipanda avatar Apr 24 '20 08:04 yuvipanda

No I don't have it now @yuvipanda I will let you know if I get sometime to work on it.

oeway avatar May 05 '20 22:05 oeway