Trying out an idea for interfacing to an out-of-process instance of R, from any client, using Redis as a middleman.
The idea is to write the R code to a Redis key, and then publish the key as the data on a channel.
The R "server" listens on the channel, and executes a callback when data is received. The R code is then retrieved and evaluated.
Once the R server has completed the evaluation, it serializes the result to JSON, writes it to a Redis key and notifies the client.
In this implementation, the client is in Ruby, and uses the mlanett-redis-lock
gem to implement the locking mechanism. Once the client has written the R code it publishes and awaits the response by taking out a lock. The R server clears the lock once the evaluation has completed.