Created
February 11, 2019 17:37
-
-
Save tomykaira/aaafc7ec3b3bda47aecc1df87af5b034 to your computer and use it in GitHub Desktop.
Run remote jupyter server (server = windows + WSL + SSH)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
set -e | |
local_json=/tmp/jupyter-kernel.json | |
rm nohup.out | |
pkill -f "jupyter-kernel.exe" | |
nohup ssh win "/mnt/c/Users/tomyk_000.GALLERIAXTWIN81/Anaconda3/Scripts/jupyter-kernel.exe" & | |
sleep 1 | |
json_filename=$(grep -o 'kernel-.*.json' nohup.out | tail -1) | |
scp "win:/mnt/c/Users/tomyk_000.GALLERIAXTWIN81/AppData/Roaming/jupyter/runtime/$json_filename" $local_json | |
ssh win -f -N $(for pt in $(cat $local_json | jq -r '[.shell_port, .iopub_port, .stdin_port, .control_port]|map(tostring)|join("\n")'); do /bin/echo -n "-L ${pt}:localhost:${pt} "; done) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
jupyter run --existing /tmp/jupyter-kernel.json <<< "print('hello')" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment