Closed snowch closed 6 years ago
@parente that setting looks like it only allows you to set the scheme, host and port? The requirement is to be able to set the path.
I'm pretty sure it allows the path too. It gets passed to the jinja template renderer here:
populates the notebook template here:
and ultimately gets joined to a kernel path here in the JavaScript:
I think that URL join should work fine even if the ws_url
has a path included in it.
Can you give it a shot? If it works, we can send a PR to notebook to update the documentation of the websocket_url
traitlet.
I've set the parameter NotebookApp.websocket_url
:
cd /home/jovyan/work
. /usr/local/bin/start.sh jupyter notebook --debug \
--no-browser \
--port=$NB_PORT \
--NotebookApp.ip=0.0.0.0 \
--NotebookApp.websocket_url=$KG_WS_URL \
--NotebookApp.session_manager_class=nb2kg.managers.SessionManager \
--NotebookApp.kernel_manager_class=nb2kg.managers.RemoteKernelManager \
--NotebookApp.kernel_spec_manager_class=nb2kg.managers.RemoteKernelSpecManager 2>&1
However, I only see http calls in the log output, no ws calls.
To enable me to debug this further, is it possible to switch on http/ws trace debugging so the log output shows the actual http/ws requests and responses?
Update: I found out that I can debug the ws calls in the browser in a notebook session.
I've identified some differences in the behavoir ...
This works:
NotebookApp.websocket_url
not setos.getenv('KG_WS_URL', KG_URL.replace('http', 'ws')),
data-ws-url=""
ws://0.0.0.0:8686/api/kernels/****
This doesn't work:
NotebookApp.websocket_url
is set to my spark clusteros.getenv('KG_WS_URL', KG_URL.replace('http', 'ws')),
data-ws-url="wss%3A//sparkhost%3A8443/gateway/default/jkgws/"
wss://sparkhost:8443/gateway/default/jkgws//api/kernels/*****
@snowch Merging your original since clearly the alternative doesn't do what I think it did. Thanks for experimenting with the command line parameter and your patience.
Thanks, @parente! No worries - it was a really useful adventure into the jupyter source code for me. The code is starting to feel familiar which is nice :)
nb2kg does not work when connecting to a host that has different urls for WS and HTTP, for example:
This patch allows users to specify the KG_WS_URL.