Remote execution via string
First, thank you for this excellent package!
I wonder if it's possible to support remote execution via ssh tunneling. I saw there is the ability to execute a string with runexpr() but it does a cd(dir) before executing the string. Maybe a simple change could provide a way for remote execution via ssh without too much trouble:
https://github.com/aminnj/DaemonMode.jl/commit/eb842941c7b2ae4a100f8b39e676fe56095be405
(Then one can bypass the cd(dir) by feeding cwd=".")
Remote machine
julia --startup-file=no -e "using DaemonMode; serve(3001)"
Local machine
# script to verify we're indeed executing on the remote machine
$ cat test.jl
println(run(`ls`))
# tunnel locally
ssh -N -f -L localhost:3001:localhost:3001 <remote-hostname>
# send the script as a string to be executed on the remote machine.
julia --startup-file=no -e 'using DaemonMode; runexpr(read("test.jl", String), cwd=".", port=3001)'
Thank you, @aminnj, for your nice comment :smile:.
It is true that it could be easy to have a remote version. It is only needed:
- To allow client to indicate where the daemon is running (you avoid this problem using ssh tunneling, but it requires more knowledge).
- To change the include in scripts to automatically dowload from the client machine (but for an experimental version it could be postponed).
- To avoid the directory change.
Currently I am travelling online for my holidays, but when I return I expect to work on the remote version. I will inform you when I will have a first working version.
Best regards
If you're interested in remote execution, do check out my package https://github.com/c42f/RemoteREPL.jl
I've already got three different types of tunnels there including ssh, and I'm considering adding other transport mechanisms (for example, a TLS-based transport to allow operation without a tunnel).
There's quite a lot of similarities between DaemonMode and RemoteREPL so we could probably share a lot of the basic infrastructure (tunnels, wire protocol, persistent connections, etc).