Skip to content

Commit

Permalink
Install PLE & PLP packages into default library folder due to issue #2
Browse files Browse the repository at this point in the history
…with ParallelLogger
  • Loading branch information
pavgra committed Jun 6, 2019
1 parent 20356c0 commit b7e8bd0
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 14 deletions.
9 changes: 2 additions & 7 deletions src/main/resources/resources/estimation/r/runAnalysis.R
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
setwd("./")
libs_local <- file.path(getwd(), "libs-local")
tryCatch({
unzip('@packageFile', exdir = file.path(".", "@analysisDir"))
dir.create(libs_local)
callr::rcmd("build", c("@analysisDir", c("--no-build-vignettes")), echo = TRUE, show = TRUE)
pkg_file <- list.files(path = ".", pattern = "\\.tar\\.gz")[1]
tryCatch({
install.packages(pkg_file, lib = libs_local, repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
install.packages(pkg_file, repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
}, finally = {
file.remove(pkg_file)
})
}, finally = {
unlink('@analysisDir', recursive = TRUE, force = TRUE)
})

.libPaths(c(.libPaths(), libs_local))

library(DatabaseConnector)
library(@packageName)

Expand Down Expand Up @@ -56,6 +52,5 @@ tryCatch({
maxCores = maxCores,
minCellCount = 5)
}, finally = {
remove.packages('@packageName', lib = libs_local)
unlink(libs_local, recursive = TRUE, force = TRUE)
remove.packages('@packageName')
})
9 changes: 2 additions & 7 deletions src/main/resources/resources/prediction/r/runAnalysis.R
Original file line number Diff line number Diff line change
@@ -1,21 +1,17 @@
setwd("./")
libs_local <- file.path(getwd(), "libs-local")
tryCatch({
unzip('@packageFile', exdir = file.path(".", "@analysisDir"))
dir.create(libs_local)
callr::rcmd("build", c("@analysisDir", c("--no-build-vignettes")), echo = TRUE, show = TRUE)
pkg_file <- list.files(path = ".", pattern = "\\.tar\\.gz")[1]
tryCatch({
install.packages(pkg_file, lib = libs_local, repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
install.packages(pkg_file, repos = NULL, type="source", INSTALL_opts=c("--no-multiarch"))
}, finally = {
file.remove(pkg_file)
})
}, finally = {
unlink('@analysisDir', recursive = TRUE, force = TRUE)
})

.libPaths(c(.libPaths(), libs_local))

library(DatabaseConnector)
library(@packageName)

Expand Down Expand Up @@ -56,6 +52,5 @@ tryCatch({
# To run PLP Viewer shiny app call:
# PatientLevelPrediction::viewPlp(readRDS("./shiny/PLPViewer/data/Analysis_1/plpResult.rds"))
}, finally = {
remove.packages('@packageName', lib = libs_local)
unlink(libs_local, recursive = TRUE, force = TRUE)
remove.packages('@packageName')
})

0 comments on commit b7e8bd0

Please sign in to comment.