Working with created environment within Package and Opal Server

Morning all,

What am I trying to achieve? I need to keep some states on the server with some hidden values and hidden environments. It is for some complex computations.

Does the server package works on outside the Opal server? Yes, but devtools::checks suggests writing to the global env is not suitable.

What I have done? I created a small package that increment and decrement from a value stored in an environment referred as .DangerEnv.

_commits Opal Server Compliant can be added to the Opal server. But the following errors are thrown using the following code. - This version passes on all aspects of devtools::check().

source(‘~/Documents/GitHub/ds.client.connection.server/ds.client.connection.server/error_testing/test_inc_and_dec_single.R’) [1] “https://192.168.56.100:8443” server url table resource driver user password 1 Paris https://192.168.56.100:8443 TESTING.DATASET1 OpalDriver administrator datashield_test& token options 1 list(ssl_verifyhost=0,ssl_verifypeer=0)

Logging into the collaborating servers Logged in all servers [================================================================] 100% / 1s

Assigning table data… Assigned all tables [==================================================================] 100% / 2s $Paris An object of class “OpalConnection” Slot “name”: [1] “Paris”

Slot “opal”: url: https://192.168.56.100:8443 name: Paris version: 3.0.7 username: administrator rid: 2d732e59-8bd7-45d0-8d6c-db66259818f1

dimDS(“D”) Aggregated (dimDS(“D”)) [==============================================================] 100% / 0s $Paris [1] 71 16

[1] “incDS” incDS() Aggregated (incDS()) [=================================================================] 100% / 0s The client-side function named ds.aggregate is not working has expected. An error has occurred on the server. The function incDS has not been able to either assign or return an aggregation.

server Paris : cannot change value of locked binding for ‘.DangerEnv’ [1] “NR” [1] “decDS” decDS() Aggregated (decDS()) [=================================================================] 100% / 0s The client-side function named ds.aggregate is not working has expected. An error has occurred on the server. The function decDS has not been able to either assign or return an aggregation.

server Paris : cannot change value of locked binding for ‘.DangerEnv’ [1] “NR” [1] TRUE

_script _

# one server 
server.names      <- c("Paris")
url_Paris         <- 'https://192.168.56.100:8443'
table_Paris       <- "TESTING.DATASET1"
user_Paris        <-  "administrator"
password_Paris    <-  "datashield_test&"
ssl_options_Paris <- "list(ssl_verifyhost=0,ssl_verifypeer=0)"
driver_Paris      <- "OpalDriver"


server.urls       <- c(url_Paris)
server.tables     <- c(table_Paris)
server.users.id   <- c(user_Paris)
server.users.pwd  <-  c(password_Paris)
server.ssl.options <- c(ssl_options_Paris)
server.drivers   <- c(driver_Paris)
print(server.urls)

# build datasets 
login.data <- ds.build.login.data.frame(server.names,
                                        server.urls,
                                        server.tables,
                                        server.users.id,
                                        server.users.pwd,
                                        server.ssl.options,
                                        server.drivers)
print(login.data)

# connect to server
server.var <- list('ID','CHARACTER', 'LOGICAL','NA_VALUES','INTEGER','NULL_VALUES',
                   'NON_NEGATIVE_INTEGER','POSITIVE_INTEGER','NEGATIVE_INTEGER',
                   'NUMERIC', 'NON_NEGATIVE_NUMERIC','POSITIVE_NUMERIC','NEGATIVE_NUMERIC',
                   'FACTOR_CHARACTER','FACTOR_INTEGER','IDENTIFIER','CATEGORY','IDENTIFIER',
                   'CATEGORY')
connections <- ds.login(login.data, variables = server.var, symbol = 'D')
print(connections)


# sanity check errors option set to true by default
server.function.call <- call('dimDS','D')
print(server.function.call)
outcome <- ds.aggregate(expression = server.function.call, asynchronous = FALSE, datasources = connections)
print(outcome)

print("incDS")
server.function.call <- call('incDS')
print(server.function.call)
outcome <- ds.aggregate(expression = server.function.call, asynchronous = FALSE, datasources = connections)
print(outcome)

print("decDS")
server.function.call <- call('decDS')
print(server.function.call)
outcome <- ds.aggregate(expression = server.function.call, asynchronous = FALSE, datasources = connections)
print(outcome)


outcome <- ds.logout(connections)
print(outcome)

with unbind instructions - devtools::check() suggest unsafe operation (agree with it). Opal Server does not upload it.

The links will bring you to GitHub various commits. Use it to explore the package and help, please. How can we keep some states on the server with some hidden values and hidden environments?

Can somebody demonstrates some Opal Server compliant techniques, please.

Thank you and best wishes,

Patricia Ryser-Welch