Skip to content

Commit

Permalink
Merge pull request #423 from NREL/rserve-dependency-checks
Browse files Browse the repository at this point in the history
Check if R libraries install correctly
  • Loading branch information
anyaelena committed Nov 2, 2018
2 parents caa358d + 417c035 commit f13754d
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 13 deletions.
2 changes: 1 addition & 1 deletion docker/R/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
# DESCRIPTION: OpenStudio Server R Container
# TO_BUILD_AND_RUN: docker-compose up

FROM nrel/openstudio-r:3.4.2
FROM nrel/openstudio-r:3.4.2-2
MAINTAINER Nicholas Long nicholas.long@nrel.gov

# Add in the additional R packages
Expand Down
33 changes: 22 additions & 11 deletions docker/R/install_packages.R
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,28 @@
# OpenStudio-R image here:
# https://raw.githubusercontent.com/NREL/docker-openstudio-r/master/base_packages.R

# Function for installing and verifying that the package was installed correctly (i.e. can be loaded)
install_and_verify = function(package_name, configure.args=c(), repos=c('http://cloud.r-project.org','http://cran.r-project.org')){
print(paste('Calling install for package ', package_name, sep=''))
install.packages(package_name, configure.args=configure.args, repos=repos)
if (!require(package_name, character.only = TRUE)){
print('Error installing package, check log')
quit(status=1)
}
print(paste('Successfully installed and test loaded ', package_name, sep=''))
}

# Install Probability / Optimization / Analysis Packages
install.packages('lhs', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install.packages('e1071', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install.packages('triangle', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install.packages('NMOF', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install.packages('mco', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install.packages('rgenoud', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install.packages('conf.design', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install.packages('combinat', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install.packages('DoE.base', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install.packages('sensitivity', repos=c('http://cloud.r-project.org','http://cran.r-project.org'))
install_and_verify('lhs')
install_and_verify('e1071')
install_and_verify('triangle')
install_and_verify('NMOF')
install_and_verify('mco')
install_and_verify('rgenoud')
install_and_verify('conf.design')
install_and_verify('combinat')
install_and_verify('DoE.base')
install_and_verify('sensitivity')

# R Serve
install.packages('Rserve', configure.args=c('PKG_CPPFLAGS=-DNODAEMON'), repos=c('http://rforge.net'))
install_and_verify('Rserve', configure.args=c('PKG_CPPFLAGS=-DNODAEMON'), repos=c('http://rforge.net'))
2 changes: 1 addition & 1 deletion server/app/lib/analysis_library/r/cluster.rb
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ def start(ip_addresses)
res <- NULL;
starttime <- Sys.time()
tryCatch({
res <- evalWithTimeout({
res <- R.utils::withTimeout({
cl <- makePSOCKcluster(ips[,1], master='openstudio.server', outfile="/mnt/openstudio/log/snow.log")
}, timeout=numunique);
}, TimeoutException=function(ex) {
Expand Down

0 comments on commit f13754d

Please sign in to comment.