Skip to content

Commit

Permalink
add descriptions for model transfer input and refactor localFiles getter
Browse files Browse the repository at this point in the history
  • Loading branch information
egillax committed Oct 8, 2024
1 parent f7adfb7 commit db24f4e
Showing 1 changed file with 17 additions and 9 deletions.
26 changes: 17 additions & 9 deletions R/Module-ModelTransferModule.R
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ ModelTransferModule <- R6::R6Class(
localFileSettings <- jobContext$settings$localFileSettings

modelLocationsS3 <- tryCatch({private$.getModelsFromS3(
s3Settings = s3Settings,
settings = s3Settings,
saveFolder = modelSaveLocation
)}, error = function(e){ParallelLogger::logInfo(e); return(NULL)}
)
Expand All @@ -77,7 +77,7 @@ ModelTransferModule <- R6::R6Class(
}

modelLocationsLocalFiles <- tryCatch({private$.getModelsFromLocalFiles(
localFileSettings = localFileSettings$locations,
settings = localFileSettings,
saveFolder = modelSaveLocation
)}, error = function(e){ParallelLogger::logInfo(e); return(NULL)}
)
Expand All @@ -88,10 +88,18 @@ ModelTransferModule <- R6::R6Class(
private$.message(paste("Results available at:", resultsFolder))
},
#' @description Creates the ModelTransferModule Specifications
#' @param s3Settings description
#' @param githubSettings description
#' @param localFileSettings description
#' include steps to compute inclusion rule statistics.
#' @param s3Settings a dataframe with columns:
#' bucket - the S3 bucket to download from
#' modelZipLocation - the subfolder in the bucket where the models are stored in a zip file
#' region - the region of the S3 bucket
#' @param githubSettings a dataframe with columns:
#' user - the github user/organization to download from
#' repository - the github repository to download from
#' ref - the branch/tag/commit to download from
#' modelsFolder - the folder in the repository where the models are stored
#' modelFolder - optional, the subfolder in the modelsFolder where a particular model is stored
#' @param localFileSettings a dataframe with a single column:
#' locations - the location of the models on the local file system
createModuleSpecifications = function(s3Settings = NULL,
githubSettings = NULL,
localFileSettings = NULL) {
Expand All @@ -114,9 +122,9 @@ ModelTransferModule <- R6::R6Class(
}
),
private = list(
.getModelsFromLocalFiles = function(localFileSettings, saveFolder) {
.getModelsFromLocalFiles = function(settings, saveFolder) {

if (is.null(localFileSettings)) {
if (is.null(settings)) {
return(NULL)
}

Expand All @@ -126,7 +134,7 @@ ModelTransferModule <- R6::R6Class(

saveFolder <- file.path(saveFolder, "models")

localFileSettings <- fs::path_expand(localFileSettings)
localFileSettings <- fs::path_expand(settings$locations)
saveFolder <- fs::path_expand(saveFolder)

contents <- list.files(localFileSettings, recursive = TRUE, full.names = TRUE, include.dirs = FALSE)
Expand Down

0 comments on commit db24f4e

Please sign in to comment.