User Tools

Site Tools


documentation:software:webapi:r_service_bus_setup_guide

This is an old revision of the document!


R Service Bus Setup Guide


This is a new feature and as such is not as stable as some other parts of the OHDSI technology stack. Please ask questions on the forums if you have any issues establishing your environment so we can improve the level of support we provide here in the documentation.

Installation Steps

  • Install R

Required R Packages

RSB requires additional the following R Packages be loaded into your R environment

install.packages("XML")
install.packages("RJSONIO")
install.packages(c("properties", "RSBXml", "RSBJson"), repos = "http://repos.openanalytics.eu", type = "source")
install.packages(c("rj", "rj.gd"), repos="http://download.walware.de/rj-2.0")
  • Deploy R Service Bus WAR

Test RSB deployment status:

  http://webserver/rsb/api/rest/system/health/check
  • Deploy RPooli WAR
    • requires R_HOME environment variable

The poolconfig.properties and rconfig.properties files are typically found in the WEB-INF subdirectory of the rpooli installation. For example:

C:\Program Files\Apache Software Foundation\Tomcat 8.0\webapps\rpooli\WEB-INF

Sample poolconfig.properties

max_wait.millis=3000
min_idle.millis=600000
max_total.count=20
eviction_timeout.millis=1800000
max_idle.count=10
min_idle.count=5
max_usage.count=100

Sample rconfig.properties

de.walware.rj.rpkg.path=C\:\\R\\Packages
r_home.path=C\:\\Program Files\\R\\R-3.3.1
r_startup.snippet=library(RSBXml)\r\nlibrary(RSBJson)\r\nlibrary(OhdsiServiceWrapper)\r\noptions('fftempdir' = 'C:/FFTemp')
debug_verbose.enabled=true
debug_console.enabled=false
node_cmd.args=
startstop_timeout.millis=30000

Enabling CORS access to RPooli

To enable CORS on Tomcat add the following section to the RPooli web.xml

<filter>
  <filter-name>CorsFilter</filter-name>
  <filter-class>org.apache.catalina.filters.CorsFilter</filter-class>
</filter>
<filter-mapping>
  <filter-name>CorsFilter</filter-name>
  <url-pattern>/*</url-pattern>
</filter-mapping>

Sending a Job to your R Pool

Sending a job to the RSB Rest Job endpoint is a POST to the following endpoint:

  http://webserver/rsb/api/rest/jobs

The Job message format is as follows:

{
  "RFunction":"paste",
  "a": 1, 
  "b" : 2
}

wherein the RFunction attribute contains the function that will be the target of an R call to do.call and the remaining named attributes will be passed as a named list of parameters to the RFunction.

Debugging an Installation

Make sure R is up to date and all the necessary R packages have been installed. Start by checking your container log file, for example if you are running in Tomcat, check the Tomcat log for errors.

R Logging

Logs generated by R processing can be found within the container's log directory. Typically something like

C:\Program Files\Apache Software Foundation\Tomcat 8.0\temp\rpooli-1474396212594

You will find a directory for each node within your R Pool with individual output log files.

documentation/software/webapi/r_service_bus_setup_guide.1521478334.txt.gz ยท Last modified: 2018/03/19 16:52 by frank_defalco