notebook icon indicating copy to clipboard operation
notebook copied to clipboard

Cannot reproduce unix socket example

Open vsoch opened this issue 3 years ago • 2 comments
trafficstars

Describe the bug

I'm trying to reproduce the only documentation / example I can find for unix sockets, here: https://github.com/jupyter/notebook/pull/4835 And when I do nc -U /tmp/name.sock I don't see an error, but I don't see any output at all. I've also read the comments in the template here and opened an issue on jupyterhub, but I don't see there is any support for this same kind of "one off" socket.

To Reproduce

I have a cluster for which ports don't work (:sob:) so I'm really really hopeful that I might be able to get this to work! I started with a complex example of the socket created on an isolated worker node, and was able to authenticate (maybe to connect?) but the browser response was not successful. I then simplified this to just launch on a login node and use the exact command provided verbatim, and that didn't work. Then I moved to my local machine and just tried to reproduce the example shown in the PR, but that didn't reproduce so now I'm wondering if this works still?

TLDR: to reproduce, I think you can just run the example in the PR linked above.

If there is a notebook 7.x variant that I should try, please point me to it! I'm not hugely familiar with this ecosystem beyond using jupyter from conda/pip. I did try to install from the main branch here and:

AttributeError: module 'hatchling.build' has no attribute 'prepare_metadata_for_build_editable'
      

Expected behavior

When I connect to the socket via ssh with the provided command I should be able to open my browser to port 8888 and see an empty notebook.

Desktop (please complete the following information):

  • OS: Ubuntu 22.04
  • Browser I tried Firefox, Brave, and Chrome (all the same)
  • Version6.4.8

Thank you!

vsoch avatar Jun 25 '22 21:06 vsoch

Wanted to post a quick update that I got it working - I had to modify the command quite a bit for my setup! I'm going to do a short writeup that I'll share (maybe not today but tomorrow) for others to find in case it's useful. Someone did report that the above worked for them on a Mac (and different cluster resource) so I suspect it has to do with the slight variation in our clusters / setups. Anyway, will write that post soon!

vsoch avatar Jun 26 '22 00:06 vsoch

Heyo! So as promised - I did a writeup:

  • Twitter: https://twitter.com/vsoch/status/1541188213494099968
  • Link: https://vsoch.github.io/2022/ssh-tunnels/

For the simple use case (host to login node) I needed to add -T to disable asking for a pty, which in my case was aborting the request (note that the method you show does seem to work for some people).

# Running on login node
$ ssh -NT -L 8888:/tmp/test.sock user@server

But then the tricky part was getting this to work on an isolated cluster through the login node, and ultimately I came up with:

$ ssh -NT -L 8899:/home/dinosaur/login-node.sock user@server ssh isolated-node -NT -L /home/dinosaur/login-node.sock:/home/dinosaur/jupyter.sock

Basically, doing nc -U /path/to/test.sock (that was generated on the job node) from the login node resulted in a permission denied, so my solution first maps the node socket to the login node, and then we connect that socket to a port. And then it worked! So I think my suggestion would be to test adding this -T flag and discuss if there are cases where adding it would be bad, and if not, just add it to be on the conservative side and get more users with successful outcomes. And then for the detailed stuff, I can offer to post this on the jupyter discourse.

So feel free to close this if/when you are happy. I suppose we could also just leave the issue to find later!

vsoch avatar Jun 26 '22 22:06 vsoch