molgenis / molgenis-r-datashield

Armadillo implementation of DSI to be DataSHIELD ready, part of the MOLGENIS suite
https://molgenis.github.io/molgenis-r-datashield/
0 stars 3 forks source link

When assigning tables whilst logging in, two extra objects are created #83

Open timcadman opened 2 months ago

timcadman commented 2 months ago

To reproduce

Start an armadillo server locally. Then run:

url <- "http://localhost:8080/"
token <- armadillo.get_token(url)

builder <- newDSLoginBuilder()
builder$append(
  url = url,
  server = "armadillo",
  token = token,
  table = "project-1/data/nonrep",
  driver = "ArmadilloDriver")

logindata <- builder$build()
conns <- DSI::datashield.login(logins = logindata, assign = TRUE, symbol = "D")
> ds.ls()
$armadillo
$armadillo$environment.searched
[1] "R_GlobalEnv"

$armadillo$objects.found
[1] "D"                    "read_datashield_inst" "to_df"`   

Interestingly, the error only occurs the first time you perform this operation after starting a server. If you run the same code again without restarting the server, you get:

> ds.ls()
$armadillo
$armadillo$environment.searched
[1] "R_GlobalEnv"

$armadillo$objects.found
[1] "D"

Now stop the server, restart and login again, and the error returns:

> ds.ls()
$armadillo
$armadillo$environment.searched
[1] "R_GlobalEnv"

$armadillo$objects.found
[1] "D"                    "read_datashield_inst" "to_df"`   
timcadman commented 1 month ago

The problem presumably is caused by this line of code: " dplyr::do(to_df(read_datashield_inst(.)))\n";

Which can be found here