[datatable-help] svSocket+data.table

Matthew Dowle mdowle at mdowle.plus.com
Tue Oct 9 00:06:21 CEST 2012


Hi,

> What am I doing wrong?  Is this beyond the expected use-case?

;) Nothing. It's broken. Since .internal.selfref was added around v1.8.0,
by the looks of it as you suspected.

This works :

> evalServer(con, "x <- as.data.table(mtcars);NULL")
NULL

and you can then use 'x' on the server session. Which is what you'd want
anyway to suppress returning the whole data.table you just created on
server.

But doing anything useful, such as returning a subset of data, breaks with
the same error :

> evalServer(con, "x[1]")
Error in source(objcon, local = TRUE, echo = FALSE, verbose = FALSE) :
  objcon:6:27: unexpected '<'
5: "carb"), class = c("data.table", "data.frame"), row.names = c(NA,
6: -1L), .internal.selfref = <
                             ^
So either people aren't using evalServer (very likely I guess), or they've
fixed it up themselves and overloaded it.

I have been surprised by the lack of interest in svSocket::evalServer. I
suspect that people "don't get" the video and stop early, don't watch it
at all, do watch it and still don't get it, or do watch it do get it but
don't have a large RAM server to make best use of it, or do watch it do
get it and do have a large RAM server but recoil at the text transfer, or
use other similar (but not quite the same) alternatives.

Currently, it serializes via text, which can cause a speed issue. Philippe
Grosjean (cc'd) mentioned (I think) binary transfer was possible but I
haven't looked for a long time.

Hm - there was a bug fix to evalServer in April 2012 I see now. Someone's
using it then.

Maybe you could follow up, fix it for data.table, and get it doing binary
transfer, please? :)

Matthew


> I saw the svSocket + data.table video on the data.table project home
> page.  It looks pretty cool, so I am trying to implement it.  I can
> get it to work with a data.table if I save the data.table to a file,
> put the file on the server and load it.  However, I cannot figure out
> how to create a data.table on the server, or to send a data.table to
> the server.
>
> First, I start R and run this:
>
>     > library(svSocket)
>     Loading Tcl/Tk interface ... done
>     > startSocketServer(port=8888)
>     [1] TRUE
>
> In a second instance of R, I run this:
>
>     > library(svSocket)
>     Loading Tcl/Tk interface ... done
>     > con <- socketConnection(port=8888)
>     > evalServer(con, library(data.table))
>     [1] "data.table" "svSocket"   "stats"      "graphics"   "grDevices"
>     [6] "utils"      "datasets"   "methods"    "base"
>
>     > evalServer(con, "x <- as.data.table(mtcars)")
>     Error in source(objcon, local = TRUE, echo = FALSE, verbose = FALSE) :
>       objcon:32:67: unexpected '<'
>     31: "drat", "wt", "qsec", "vs", "am", "gear", "carb"), row.names =
> c(NA,
>     32: -32L), class = c("data.table", "data.frame"), .internal.selfref =
> <
>
>                         ^
> If I try to create the data.table in the client and send it to the
> server, R just hangs and I have to hit Ctrl+c to break.
>
>     > library(data.table)
>     data.table 1.8.3  For help type: help("data.table")
>     > evalServer(con, x, as.data.table(mtcars))
>     ^C
>     Warning message:
>     In dump("..Last.value", file <- .f) : deparse may be incomplete
>
> Simple things work fine:
>
>     > evalServer(con, x, 1)
>     [1] TRUE
>     > evalServer(con, x)
>     [1] 1
>
> Also, I should mention that I can run `as.data.table(mtcars)` just
> fine from either terminal without using `evalServer`
>
> It appears that there may be a problem parsing the .internal.selfref
> attribute.
>
> What am I doing wrong?  Is this beyond the expected use-case?
>
> Thanks,
> Garrett
>
> p.s. sessionInfo below; I have the same problem on both Mac and Linux
>> sessionInfo()
> R version 2.15.1 (2012-06-22)
> Platform: x86_64-pc-linux-gnu (64-bit)
>
> locale:
>  [1] LC_CTYPE=en_US.UTF-8       LC_NUMERIC=C
>  [3] LC_TIME=en_US.UTF-8        LC_COLLATE=en_US.UTF-8
>  [5] LC_MONETARY=en_US.UTF-8    LC_MESSAGES=en_US.UTF-8
>  [7] LC_PAPER=C                 LC_NAME=C
>  [9] LC_ADDRESS=C               LC_TELEPHONE=C
> [11] LC_MEASUREMENT=en_US.UTF-8 LC_IDENTIFICATION=C
>
> attached base packages:
> [1] stats     graphics  grDevices utils     datasets  methods   base
>
> other attached packages:
> [1] data.table_1.8.3 svSocket_0.9-53
>
> loaded via a namespace (and not attached):
> [1] svMisc_0.9-67 tcltk_2.15.1  tools_2.15.1
>>
> _______________________________________________
> datatable-help mailing list
> datatable-help at lists.r-forge.r-project.org
> https://lists.r-forge.r-project.org/cgi-bin/mailman/listinfo/datatable-help
>




More information about the datatable-help mailing list