Controlling a Remote R Session from a Local One

October 28, 2015
By

(This article was first published on librestats » R, and kindly contributed to R-bloggers)

Say you have an Amazon EC2 instance running and you want to be able to control your R session running there from your local R session. At heart, this is not a new idea for the R community. You can already control remote R sessions easily with Shiny or RStudio server, for instance. Well now you can also try the experimental remoter package, available on github. So while this isn’t really tackling an unsolved problem, I think this approach, for better or worse, is unique.

You use it basically just like it says in the readme. The basic idea is to ssh to your remote and start up a server (I recommend using tmux for this, but you could just use fork with something like Rscript -e "remoter::server()" &). Once that’s done, you connect from your local R session with remoter::client("my.remote.address"). This ignores the usual issues, like port forwarding, which of course are relevant.

The package uses ZeroMQ by way of pbdZMQ to handle communication in a Request/Reply client/server pattern. There’s also a custom R REPL to automatically handle intercepting the local command, broadcasting it, executing it, and communicating back the return. The REPL design is kind of complicated, because it was actually designed for another purpose entirely, namely managing multiple batch MPI servers from a single client in the pbdCS package. remoter is just pbdCS with all the MPI/multiple server stuff stripped out.

I don’t know if I’d be willing to use remoter in any kind of production environment; it’s more a cool proof of concept than anything really. On the other hand, if you’re into using R on supercomputers, you might want to keep an eye on pbdCS and friends.

To leave a comment for the author, please follow the link and comment on their blog: librestats » R.

R-bloggers.com offers daily e-mail updates about R news and tutorials on topics such as: Data science, Big Data, R jobs, visualization (ggplot2, Boxplots, maps, animation), programming (RStudio, Sweave, LaTeX, SQL, Eclipse, git, hadoop, Web Scraping) statistics (regression, PCA, time series, trading) and more...



If you got this far, why not subscribe for updates from the site? Choose your flavor: e-mail, twitter, RSS, or facebook...

Comments are closed.

Search R-bloggers


Sponsors

Never miss an update!
Subscribe to R-bloggers to receive
e-mails with the latest R posts.
(You will not see this message again.)

Click here to close (This popup will not appear again)