Skip to content

Commit

Permalink
Bump renv and module refs; only test on SQLite for now
Browse files Browse the repository at this point in the history
  • Loading branch information
anthonysena committed Aug 16, 2023
1 parent bc58d17 commit c993b7a
Show file tree
Hide file tree
Showing 9 changed files with 39 additions and 28 deletions.
12 changes: 6 additions & 6 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
Package: Strategus
Type: Package
Title: Coordinating and Executing Analytics Using HADES Modules
Version: 0.0.7
Date: 2023-05-01
Version: 0.1.0
Date: 2023-08-15
Authors@R: c(
person("Martijn", "Schuemie", email = "[email protected]", role = c("aut", "cre")),
person("Anthony", "Sena", email = "[email protected]", role = c("aut")),
Expand All @@ -15,12 +15,12 @@ License: Apache License 2.0
URL: https://ohdsi.github.io/Strategus, https://github.com/OHDSI/Strategus
BugReports: https://github.com/OHDSI/Strategus/issues
Depends:
R (>= 4.0.0),
CohortGenerator (>= 0.7.0),
DatabaseConnector (>= 5.1.0)
R (>= 4.2.3),
CohortGenerator (>= 0.8.0),
DatabaseConnector (>= 6.2.3)
Imports:
targets,
renv (>= 0.15.5),
renv (>= 1.0.0),
ParallelLogger (>= 3.1.0),
dplyr,
checkmate,
Expand Down
5 changes: 5 additions & 0 deletions R/ModuleEnv.R
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,11 @@ withModuleRenv <- function(code,
script <- c(sprintf("library(Strategus, lib.loc = '%s')", libPath),
script)
# Adding Strategus dependencies to the script
libPath <- file.path(find.package("R6"), "../")
script <- c(
sprintf("library(R6, lib.loc = '%s')", libPath),
script
)
libPath <- file.path(find.package("CohortGenerator"), "../")
script <- c(sprintf("library(CohortGenerator, lib.loc = '%s')", libPath),
script)
Expand Down
7 changes: 4 additions & 3 deletions R/ModuleInstantiation.R
Original file line number Diff line number Diff line change
Expand Up @@ -193,13 +193,14 @@ instantiateModule <- function(module, version, remoteRepo, remoteUsername, modul

script <- paste(
c(
"renv::install(c('ParallelLogger', 'keyring'), prompt = FALSE)",
sprintf("ParallelLogger::addDefaultFileLogger(file.path('%s', 'moduleInitLog.txt'))", moduleFolder),
sprintf("ParallelLogger::addDefaultErrorReportLogger(fileName = file.path('%s', 'moduleInitErrorReport.txt'))", moduleFolder),
#"renv::install(c('ParallelLogger', 'keyring'), prompt = FALSE)",
#sprintf("ParallelLogger::addDefaultFileLogger(file.path('%s', 'moduleInitLog.txt'))", moduleFolder),
#sprintf("ParallelLogger::addDefaultErrorReportLogger(fileName = file.path('%s', 'moduleInitErrorReport.txt'))", moduleFolder),
"renv::restore(prompt = FALSE)"
),
collapse = "\n"
)
print(paste0("DEBUG: ", script))
tempScriptFile <- tempfile(fileext = ".R")
fileConn <- file(tempScriptFile)
writeLines(script, fileConn)
Expand Down
14 changes: 7 additions & 7 deletions inst/testdata/analysisSpecification.json
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@
"moduleSpecifications": [
{
"module": "CohortGeneratorModule",
"version": "0.1.1-1",
"version": "0.2.0-2",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand All @@ -234,7 +234,7 @@
},
{
"module": "CohortDiagnosticsModule",
"version": "0.0.7",
"version": "0.1.0-1",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -292,7 +292,7 @@
},
{
"module": "CohortIncidenceModule",
"version": "0.0.6",
"version": "0.1.0-2",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -365,7 +365,7 @@
},
{
"module": "CharacterizationModule",
"version": "0.3.2",
"version": "0.4.0-1",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -489,7 +489,7 @@
},
{
"module": "CohortMethodModule",
"version": "0.1.0",
"version": "0.2.0-1",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -1341,7 +1341,7 @@
},
{
"module": "SelfControlledCaseSeriesModule",
"version": "0.1.3",
"version": "0.2.0-1",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": {
Expand Down Expand Up @@ -2360,7 +2360,7 @@
},
{
"module": "PatientLevelPredictionModule",
"version": "0.1.0",
"version": "0.2.0-1",
"remoteRepo": "github.com",
"remoteUsername": "ohdsi",
"settings": [
Expand Down
6 changes: 5 additions & 1 deletion man/createResultDataModels.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions tests/testPostgres.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
library(testthat)
options(dbms = "postgresql")
test_check("Strategus")
# library(testthat)
# options(dbms = "postgresql")
# test_check("Strategus")
6 changes: 3 additions & 3 deletions tests/testRedshift.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
library(testthat)
options(dbms = "redshift")
test_check("Strategus")
# library(testthat)
# options(dbms = "redshift")
# test_check("Strategus")
6 changes: 3 additions & 3 deletions tests/testSqlServer.R
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
library(testthat)
options(dbms = "sql server")
test_check("Strategus")
# library(testthat)
# options(dbms = "sql server")
# test_check("Strategus")
5 changes: 3 additions & 2 deletions tests/testthat/setup.R
Original file line number Diff line number Diff line change
Expand Up @@ -34,11 +34,12 @@ if (dir.exists(Sys.getenv("DATABASECONNECTOR_JAR_FOLDER"))) {
tableSuffix <- paste0(substr(.Platform$OS.type, 1, 3), format(Sys.time(), "%y%m%d%H%M%S"), sample(1:100, 1))
tableSuffix <- abs(digest::digest2int(tableSuffix))

tempDir <- tempfile() # "C:/temp"
tempDir <- tempfile() #"C:/temp"
tempDir <- gsub("\\\\", "/", tempDir) # Correct windows path
renvCachePath <- file.path(tempDir, "strategus/renv")
moduleFolder <- file.path(tempDir, "strategus/modules")
Sys.setenv("INSTANTIATED_MODULES_FOLDER" = moduleFolder)
#Sys.setenv("INSTANTIATED_MODULES_FOLDER" = moduleFolder)
print(paste0("DEBUG: ", Sys.getenv("INSTANTIATED_MODULES_FOLDER")))
withr::defer(
{
unlink(c(tempDir, renvCachePath, moduleFolder), recursive = TRUE, force = TRUE)
Expand Down

0 comments on commit c993b7a

Please sign in to comment.