I have a GNU/Linux / Unix application in which I'd like to have an R process running in a persistant state, while receiving instructions (and data) from another process, and returning results to this process. My initial thoughts are to set something up with named pipes or such, but I believe that the R process will terminate when it reads EOF (^D) from the input pipe. The client process is meant to be a Python script. Has anyone experimented with this or developed a similar solution? TIA. -- Karsten M. Self <kmself at ix.netcom.com> http://kmself.home.netcom.com/ Evangelist, Zelerate, Inc. http://www.zelerate.org What part of "Gestalt" don't you understand? There is no K5 cabal http://gestalt-system.sourceforge.net/ http://www.kuro5hin.org -------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 232 bytes Desc: not available Url : https://stat.ethz.ch/pipermail/r-help/attachments/20001230/06493e82/attachment.bin
kmself at ix.netcom.com writes:> I have a GNU/Linux / Unix application in which I'd like to have an R > process running in a persistant state, while receiving instructions (and > data) from another process, and returning results to this process.[...]> Has anyone experimented with this or developed a similar solution?I intend to work on a similar thing from Perl for release 5 of Rcgi, but that's a little way off just yet. (Release 4 should be out this week.) The benefits of this are obvious: one of the heaviest bits of Rcgi is the repeated start-up of R; if maybe not as great as first thought: after the first start, most of R will be cached in memory if you have a reasonable amount and there's a performance loss from the extra housekeeping. My first thought is to connect it to a local socket via a process doing access control, some stupidity checking (such as not passing EOFs on to R) and housekeeping. Is that sane? -- MJR (Not an official statement) Please note changes of address http://stats.mth.uea.ac.uk/ -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> From: kmself at ix.netcom.com > Date: Sat, 30 Dec 2000 19:08:39 -0800 > User-Agent: Mutt/1.3.12i > Sender: owner-r-help at stat.math.ethz.ch > Precedence: bulk > > > --oj4kGyHlBMXGt3Le > Content-Type: text/plain; charset=us-ascii > Content-Disposition: inline > Content-Transfer-Encoding: quoted-printable > > I have a GNU/Linux / Unix application in which I'd like to have an R > process running in a persistant state, while receiving instructions (and > data) from another process, and returning results to this process. > > My initial thoughts are to set something up with named pipes or such, > but I believe that the R process will terminate when it reads EOF (^D) > from the input pipe. The client process is meant to be a Python script. > > Has anyone experimented with this or developed a similar solution? >Hi Karsten, (I have been away from e-mail for a week or so and will be back in the office on Monday 8th. So I'll send this in the hope that is useful as the other mail continues on this subject.) The RSPython interface (http://www.omegahat.org/RSPython) will probably do what you want quite conveniently. It should be faster than inter-process communication (since the R interpreter is running within the python process and sharing the same address space). Also, it avoids using strings which are highly server (i.e. R in this case) specific, lose semantic information and do not allow one to do the things that we do in the Java, Python, Perl interfaces from R & Splus. If your architecture does require separate processes for client and server, CORBA, SOAP or some similar object-oriented remote method invocation mechanism will probably be mreore robust and useful to you and others and involve about the same amount of time as implementing ad-hoc solutions for reading R commands from sockets, etc. Since R has a CORBA package and an XML parser, each of these would be relatively easy to implement for your application . A CGI script or whatever would know which "companion object" to send tasks to and that would handle the persistence of the R process/server. It might be useful for some of you to know also that I have started work on an R module for the Apache web server so that R can handle URL requests directly and generate the contents from a peristent R. This, the Perl, Python, Java and CORBA interfaces, the embedded R in Postgres, etc. are leading towards the need for a threaded version of R in the longer term. (I would like to know if and how people feel this would be useful.) And given that framework and possible use , a security model becomes more necessary and may get implemented. (The last of these is much further in the future.) Also, I intend to look at putting support for SOAP into R and SPlus. Hope this helps. D. -- _______________________________________________________________ Duncan Temple Lang duncan at research.bell-labs.com Bell Labs, Lucent Technologies office: (908)582-3217 700 Mountain Avenue, Room 2C-259 fax: (908)582-3340 Murray Hill, NJ 07974-2070 http://cm.bell-labs.com/stat/duncan -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> Date: Wed, 3 Jan 2001 17:41:29 +0000 (GMT) > From: Prof Brian Ripley <ripley at stats.ox.ac.uk> > cc: kmself at ix.netcom.com, r-help mailing list <r-help at stat.math.ethz.ch> > Sender: owner-r-help at stat.math.ethz.ch > Precedence: bulk > > On 3 Jan 2001, MJ Ray wrote: > > > Prof Brian Ripley <ripley at stats.ox.ac.uk> writes: > > > > > expressions. As of 1.2.0 you can embed Unix R (you have been able to do > > > so for ages on Windows) and that might be a neater solution. > > > > How do you mean "embed"? Sorry for naivity on this, but I've only > > done that within Gnome so far. Just a link would be fine. > > See http://developer.r-project.org/embedded.html > > NEWS says > > o Preliminary support for building R as a shared library (`libR') > under Unix. Use configure with option `--enable-R-shlib' or do > `make libR' in directory `src/main' to create the shared > library. > > There is also a linker front-end `R CMD LINK' which is useful > for creating executable programs linked against the R shared > library. > > and that's about all there is. > > The idea is that you can make a shared library version of R. libR.so, and > link your application against it. There are even some examples, but I > don't know of a link to those. >The RlibTest link in http://www.omegahat.org/download/R/other/ will give you some code that Kurt H. and I used to check all was well with the linking against libR.so and also provide some basic examples. More comprehensive examples are in the different Omegahat packages such as the RSPython, RSPerl( and more recently from the CVS tree in the R module under Apache.) D.> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- > r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html > Send "info", "help", or "[un]subscribe" > (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch > _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._ >-- _______________________________________________________________ Duncan Temple Lang duncan at research.bell-labs.com Bell Labs, Lucent Technologies office: (908)582-3217 700 Mountain Avenue, Room 2C-259 fax: (908)582-3340 Murray Hill, NJ 07974-2070 http://cm.bell-labs.com/stat/duncan -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
> > > There are more possibilities using Omegahat componentry: look on > > > www.omegahat.org. > > > > I'm confused. Although the front page says you can call Perl from R > > _and vice-versa_, only calling Perl from R seems to be documented at > > first glance. The python one looks more useful in that way.There is code in the CVS module that allows Perl call R just as in the Python case, but it is not as comprehensively documented or integrated for Perl as it is for RSPython. If you want to use it, I can put complete it quite quickly. The main reason it is not as complete as the Perl interface is that there has been less immediate interest in it than Python. Let me know if it would be worth getting it done rapidly. D. -- _______________________________________________________________ Duncan Temple Lang duncan at research.bell-labs.com Bell Labs, Lucent Technologies office: (908)582-3217 700 Mountain Avenue, Room 2C-259 fax: (908)582-3340 Murray Hill, NJ 07974-2070 http://cm.bell-labs.com/stat/duncan -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._