This project is read-only.

Cleaning up between requests

Mar 22, 2014 at 10:10 PM

I want to use R.Net to handle requests from different users.
I know that R.Net does not support concurrency and this is ok for my scenario.
I will serialize the requests and execute them one by one.

My question is, how can I "isolate" each execution from previous\following executions?
I want to be able to clean up all state between requests, so that requests will not affect each other.

I noticed the REngine.CreateIsolatedEnvironment() method, which sounds very promising, but I can't find any documentation about it to understand if it can actually do what I need.

I am a beginner with R, so I don't understand the concept of environments very well and if they can help me with what I'm trying to achieve. If there is a better way to get isolation between requests, I'll be happy to learn about it.
Can workspaces help me with isolation?
I found some mentions about doing rm, closeAllConnections and detach for cleanups, but I'm not sure if this is enough...

Again, any help would be appreciated.

Mar 23, 2014 at 11:01 AM
For someone calling oneself a beginner with R, you sound like you have put quite a bit of thought and research already actually. I would not bet I understand environments much more than you do if at all :-) , actually setting the variables in an isolated environment is something I may not even have thought of.

If you have the latitude to explore the branch named with my username I'd encourage you to do so. I have modified the API to enforce a singleton pattern and wipe the global environment between things like unit test runs; happy to clarify things on the go (as the documentation is not yet fully ready). I have not even looked at unloading packages, detaching stuff and so on so that's what I mean by you having given a fair bit of thought.

My day work needs are driven by use cases with a single "user" for R.NET's computation perspective, so I am not the most equipped to bring insights. I hope other readers can contribute.

Jul 23, 2014 at 10:49 PM

Have you found a satisfactory approach to this issue? If so, could you pl share the details?

Thanks. - Dev