Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Adding option to override database thread settings for CM & SCCS #191

Merged
merged 1 commit into from
Dec 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions R/Module-CohortMethod.R
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,14 @@ CohortMethodModule <- R6::R6Class(
jobContext <- private$jobContext
multiThreadingSettings <- CohortMethod::createDefaultMultiThreadingSettings(jobContext$moduleExecutionSettings$maxCores)

# Provide hook to allow for overriding the number of threads
# used for database operations
getDbCohortMethodDataThreads <- as.integer(getOption("strategus.CohortMethodModule.getDbCohortMethodDataThreads"))
if (isTRUE(getDbCohortMethodDataThreads > 0)) {
private$.message(paste0("Detected strategus.CohortMethodModule.getDbCohortMethodDataThreads - setting value to: ", getDbCohortMethodDataThreads))
multiThreadingSettings$getDbCohortMethodDataThreads <- getDbCohortMethodDataThreads
}

args <- jobContext$settings
args$connectionDetails <- connectionDetails
args$cdmDatabaseSchema <- jobContext$moduleExecutionSettings$cdmDatabaseSchema
Expand Down
8 changes: 8 additions & 0 deletions R/Module-SelfControlledCaseSeries.R
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,14 @@ SelfControlledCaseSeriesModule <- R6::R6Class(
jobContext <- private$jobContext
sccsMultiThreadingSettings <- SelfControlledCaseSeries::createDefaultSccsMultiThreadingSettings(jobContext$moduleExecutionSettings$maxCores)

# Provide hook to allow for overriding the number of threads
# used for database operations
getDbSccsDataThreads <- as.integer(getOption("strategus.SelfControlledCaseSeriesModule.getDbSccsDataThreads"))
if (isTRUE(getDbSccsDataThreads > 0)) {
private$.message(paste0("Detected strategus.SelfControlledCaseSeriesModule.getDbSccsDataThreads - setting value to: ", getDbSccsDataThreads))
sccsMultiThreadingSettings$getDbSccsDataThreads <- getDbSccsDataThreads
}

args <- jobContext$settings
args$connectionDetails <- connectionDetails
args$cdmDatabaseSchema <- jobContext$moduleExecutionSettings$cdmDatabaseSchema
Expand Down
Loading