dmolina / DaemonMode.jl

Client-Daemon workflow to run faster scripts in Julia
MIT License
272 stars 16 forks source link

Remote execution via string #39

Open aminnj opened 3 years ago

aminnj commented 3 years ago

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)'
dmolina commented 3 years ago

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:

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

c42f commented 2 years ago

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).