Re: [Rd] concurrent requests (Rook, but I think the question is more general)

From: Simon Urbanek <simon.urbanek_at_r-project.org>
Date: Thu, 25 Oct 2012 13:44:15 -0400

Richard,

that is not what I had in mind :). Also Rserve 0.x doesn't have built-in HTTP, only the 1.x series does. Unfortunately I don't have any time today to write example code, but I would suggest using HTTP for both - just have a hook that simply accepts serialized R object in the body of the HTTP request and assigns it to your result. Then you have a second hook that delivers the result back (in whatever form you want it). It should be really easy to do with Rook in a separate process. In your computation session you simply fire off a HTTP POST request with the current status as a serialized R object.

Cheers,
Simon

On Oct 25, 2012, at 11:45 AM, Richard D. Morey wrote:

> On 24/10/12 10:55 PM, Simon Urbanek wrote:

>> 
>> The point is that you need a separate monitoring process or threads. That process can be R, Rserve or any thing else.
>> 
>> 
>> 

>
> Thanks for the tips. This is what I'm currently contemplating:
>
> 1. Main interface starts in user's R session, and opens up the interface (HTML/Javascript using Rook package)
> 2. When analysis starts, Rserve is started, with its own web server, using Rook, for status updates
> 3. During analysis, main process calls a callback function which uses RSassign() to send progress updates to the Rserve server
> 4. HTML/Javascript interface can connect to the webserver on the Rserve server to get status updates
> 5. When analysis is done, use RSshutdown() and RSclose() to clean up.
>
> Does this seem reasonable?
>
> One problem I'm having is that when I start Rook on the Rserve server, the webserver does not respond (although it is started). Does Rserve only respond to requests on the port assigned for RSclient commands?
>
> Best,
> Richard
>
> Here's an example:
>
> #######################
>
> library(Rserve)
>
> ### This works:
>
> stuff = expression({
> library(Rook)
> s <- Rhttpd$new()
> s$add(
> app=system.file('exampleApps/helloworld.R',package='Rook'),
> name='hello'
> )
> s$start(quiet=TRUE)
> s$browse(1)
> print(s$full_url(1))
> })
>
> # This will open the browser to the test app, asking for your name
> eval(stuff)
>
> ### This does not:
>
> Rserve(args="--no-save")
> c <- RSconnect()
> RSassign(c, stuff)
>
> # This opens the browser to the correct URL, but the webserver doesn't respond.
> RSeval(c, quote(eval(stuff)))
>
>
> #####
> # cleanup
> RSshutdown(c)
> RSclose(c)
>
>
>
>
>
>


R-devel_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel Received on Thu 25 Oct 2012 - 17:48:19 GMT

This quarter's messages: by month, or sorted: [ by date ] [ by thread ] [ by subject ] [ by author ]

All messages

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Fri 26 Oct 2012 - 00:00:49 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-devel. Please read the posting guide before posting to the list.

list of date sections of archive