Binderhub: Add support for jupyter notebook command line options in binder

Created on 21 Dec 2017  Â·  16Comments  Â·  Source: jupyterhub/binderhub

I would like to be able to configure jupyter notebook command line options when using binder.

http://jupyter-notebook.readthedocs.io/en/stable/config.html

Currently this is not possible with binder. Please add this functionality.

Most helpful comment

It turns out I found this repo in the VoilĂ  gallery which uses exactly what I'm looking for!
In the jupyter_config.json file, one can specify VoilaConfiguration options for Binder to use.

EDIT: Relevant documentation here

All 16 comments

One way to workaround this is to create a jupyter_notebook_config.py that you copy to ~/.jupyter/ in a postBuild.

What kind of things would you like to be able to configure? Maybe we should make it a special file that if it is in the repo gets copied to the right place for you.

I want to enable websocket_compression_options so that the data sent across the internet from binder to the notebook front-end is compressed. Compression used to be enabled by default but because jupyter notebook running on a local machine does not send data across the internet they decided to turn off compression by default to get a performance boost in a notebook release earlier this year. But with my notebook application sending a lot of data back and forth between Binder and the notebook front-end I would like to compress the data that is sent across the internet to reduce bandwidth consumption. I would like to be able to configure this option from the jupyter notebook documentation.

NotebookApp.websocket_compression_options : Any
Default: None

Set the tornado compression options for websocket connections.

This value will be returned from WebSocketHandler.get_compression_options(). None (default) will disable compression. A dict (even an empty one) will enable compression.

See the tornado docs for WebSocketHandler.get_compression_options for details.

The PR that resulted in the decision to turn of compression by default can be found here.

https://github.com/jupyter/notebook/issues/2490

Let us know if the above workaround works for you. Let's keep the discussion on whether to enable it by default or not in this issue as well (going to close #376)

We should allow users to specify arbitrary commands to run, instead of making something specific for just Jupyter commands in the long run. Probably a URL parameter like we have for urlpath / filepath now?

+1

On Thu, Dec 21, 2017 at 10:33 PM Yuvi Panda notifications@github.com
wrote:

We should allow users to specify arbitrary commands to run, instead of
making something specific for just Jupyter commands in the long run.
Probably a URL parameter like we have for urlpath / filepath now?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/jupyterhub/binderhub/issues/375#issuecomment-353463099,
or mute the thread
https://github.com/notifications/unsubscribe-auth/ABwSHQthv7ohROZKEaWCzc_ZIh51_fG0ks5tCs62gaJpZM4RJIhc
.

Not sure, it feels like wanting to run arbitrary commands is an "exotic" thing to do so I'd be Ok with people having to write a Dockerfile to do that. What kind of usecases are there where you need to run an arbitrary command?

I agree not yet, but I want to keep the binderhub code as non-jupyter specific as possible...

https://github.com/jupyterhub/binderhub/issues/258 has more on supporting non-jupyter stuff directly.

I think we should turn it on by default. From the issue it looks like it was turned off by default to optimize for the localhost case, but for our case we should probably turn it on.

(sorry, i posted my comment in the wrong issue and then deleted it :-/)

The workaround worked for me to turn on compression. I configured the line
c.NotebookApp.websocket_compression_options = {}
in jupyter_notebook_config.py file. Then I created a postBuild.sh file with the following 2 lines.

!/bin/bash

cp jupyter_notebook_config.py ~/.jupyter/

After launching binder and using Chrome browser I checked the websocket request headers and response headers contained the line

sec-websocket-extensions:permessage-deflate

indicating that permessage-deflate compression is configured on the websocket.

I haven't found anything new on this so I'll allow myself to revive this issue.

tl;dr --> Is it possible to give arbitrary command line options to be specified when Binder launches the Jupyter server?

My use case is the following:
I want to run VoilĂ  with Binder and download generated files (by VoilĂ ) from within VoilĂ . Because VoilĂ  doesn't serve static files by default, I need to configure the Jupyter server with something like jupyter notebook --VoilaConfiguration.file_whitelist="..."(see here).
I haven't found any way to configure this with jupyter_notebook_config.py or anything else, and because I am doing all of this within Binder, my only option right now seems to be the Dockerfile route.

Thank you

Hi Thomas

You can try add a postBuild file your github repository that you are using with myBinder . In my case the contents of the postBuild file is

jupyter notebook --NotebookApp.websocket_compression_optionsAny={}

and this will turn on websocket compression when the jupyter notebook is launched on myBinder . In your case the contents of the postBuild file will be something like

jupyter notebook --VoilaConfiguration.file_whitelist="..."

Here is an example repository on github that contains a a postBuild file

https://github.com/jcoady/notebook

and when you run it on myBinder the command line option

jupyter notebook --NotebookApp.websocket_compression_optionsAny={}

specifed in the postBuild file is executed and websocket compression is turned on in myBinder.

John

From: "thomas-bc" notifications@github.com
To: "jupyterhub/binderhub" binderhub@noreply.github.com
Cc: "johncoady" johncoady@shaw.ca, "Author" author@noreply.github.com
Sent: Monday, January 11, 2021 8:00:52 AM
Subject: Re: [jupyterhub/binderhub] Add support for jupyter notebook command line options in binder (#375)

I haven't found anything new on this so I'll allow myself to revive this issue.

tl;dr --> Is it possible to give arbitrary command line options to be specified when Binder launches the Jupyter server?

My use case is the following:
I want to run [ https://github.com/voila-dashboards/voila | VoilĂ  ] with Binder and download generated files (by VoilĂ ) from within VoilĂ . Because VoilĂ  [ https://voila.readthedocs.io/en/stable/customize.html#serving-static-files | doesn't serve static files by default ] , I need to configure the Jupyter server with something like jupyter notebook --VoilaConfiguration.file_whitelist="..." ( [ https://voila.readthedocs.io/en/stable/customize.html#configure-voila-for-the-jupyter-server | see here ] ).
I haven't found any way to configure this with jupyter_notebook_config.py or anything else, and because I am doing all of this within Binder, my only option right now seems to be the Dockerfile route.

Thank you

—
You are receiving this because you authored the thread.
Reply to this email directly, [ https://github.com/jupyterhub/binderhub/issues/375#issuecomment-758044086 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AAD4LZKRE42NUGEGT3NIBQ3SZMODJANCNFSM4EJERBOA | unsubscribe ] .

Thank you for your answer. I am aware of the postBuild functionality, it is however _- I think? -_ not fit to be used like this in my use case, as I need Binder to be launched with a specific command, and not simply run a specific command before launching Binder.
It would work if there was a config file I could tweak to change the file_whitelist, but I haven't seen anything like this on the Voila side...

Maybe there's something I missed, I'm not really sure how your repo can work with jupyter notebook ... being run in the postBuild. This should start a jupyter server during the image build, and therefore the build won't ever finish? It's also not the workaround that was described earlier:

The workaround worked for me to turn on compression. I configured the line
c.NotebookApp.websocket_compression_options = {}
in jupyter_notebook_config.py file. Then I created a postBuild.sh file with the following 2 lines.

!/bin/bash

cp jupyter_notebook_config.py ~/.jupyter/

I am not a jupyter or binder developer so I don't have an answer to your question aside from my experience in using postBuild which did what I required for my application.

John

From: "thomas-bc" notifications@github.com
To: "jupyterhub/binderhub" binderhub@noreply.github.com
Cc: "johncoady" johncoady@shaw.ca, "Author" author@noreply.github.com
Sent: Monday, January 11, 2021 11:43:21 AM
Subject: Re: [jupyterhub/binderhub] Add support for jupyter notebook command line options in binder (#375)

Thank you for your answer. I am aware of the postBuild functionality, it is however - I think? - not fit to be used like this in my use case, as I need Binder to be launched with a specific command, and not simply run a specific command before launching Binder.
It would work if there was a config file I could tweak to change the file_whitelist, but I haven't seen anything like this on the Voila side...

Maybe there's something I missed, I'm not really sure how your repo can work with jupyter notebook ... being run in the postBuild. This should start a jupyter server during the image build, and therefore the build won't ever finish? It's also not the workaround that was described earlier:

The workaround worked for me to turn on compression. I configured the line
c.NotebookApp.websocket_compression_options = {}
in jupyter_notebook_config.py file. Then I created a postBuild.sh file with the following 2 lines.

!/bin/bash

cp jupyter_notebook_config.py ~/.jupyter/

—
You are receiving this because you authored the thread.
Reply to this email directly, [ https://github.com/jupyterhub/binderhub/issues/375#issuecomment-758179587 | view it on GitHub ] , or [ https://github.com/notifications/unsubscribe-auth/AAD4LZKIWAYS2QTO62W6ZJDSZNIFTANCNFSM4EJERBOA | unsubscribe ] .

It turns out I found this repo in the VoilĂ  gallery which uses exactly what I'm looking for!
In the jupyter_config.json file, one can specify VoilaConfiguration options for Binder to use.

EDIT: Relevant documentation here

Was this page helpful?
0 / 5 - 0 ratings