From 2443d094ce9194c154d858b499efaf1efbb82697 Mon Sep 17 00:00:00 2001 From: eblondel Date: Sun, 28 May 2023 23:26:32 +0200 Subject: [PATCH] fix #262 align custom global action check new action params --- R/geoflow_action.R | 2 +- R/initWorkflow.R | 12 ++++++------ man/geoflow_action.Rd | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/R/geoflow_action.R b/R/geoflow_action.R index 97d42d77..a98a84d7 100644 --- a/R/geoflow_action.R +++ b/R/geoflow_action.R @@ -23,7 +23,7 @@ #' packages = list(), #' pid_generator = NULL, #' generic_uploader = FALSE, -#' fun = function(config, entity){}, +#' fun = function(action, entity, config){}, #' available_options = list( #' option_name = list(def = "option description", default = FALSE) #' ), diff --git a/R/initWorkflow.R b/R/initWorkflow.R index df539a7d..89ba247f 100644 --- a/R/initWorkflow.R +++ b/R/initWorkflow.R @@ -568,21 +568,21 @@ initWorkflow <- function(file, dir = ".", jobDirPath = NULL, handleMetadata = TR stop(errMsg) } funparams <- unlist(names(formals(customfun))) - if(!("entity" %in% funparams)){ + if(!("action" %in% funparams)){ config$logger.warn(sprintf("Action '%s' - Custom action arguments: [%s]", action$id, paste(funparams, collapse=","))) - errMsg <- sprintf("Missing parameter 'entity' in function '%s'", action$id) + errMsg <- sprintf("Missing parameter 'action' in function '%s'", action$id) config$logger.error(errMsg) stop(errMsg) } - if(!("config" %in% funparams)){ + if(!("entity" %in% funparams)){ config$logger.warn(sprintf("Custom action arguments: [%s]", paste(funparams, collapse=","))) - errMsg <- sprintf("Missing parameter 'config' in function '%s'", action$id) + errMsg <- sprintf("Missing parameter 'entity' in function '%s'", action$id) config$logger.error(errMsg) stop(errMsg) } - if(!("options" %in% funparams)){ + if(!("config" %in% funparams)){ config$logger.warn(sprintf("Custom action arguments: [%s]", paste(funparams, collapse=","))) - errMsg <- sprintf("Missing parameter 'options' in function '%s'", action$id) + errMsg <- sprintf("Missing parameter 'config' in function '%s'", action$id) config$logger.error(errMsg) stop(errMsg) } diff --git a/man/geoflow_action.Rd b/man/geoflow_action.Rd index 5d7794a2..7a189171 100644 --- a/man/geoflow_action.Rd +++ b/man/geoflow_action.Rd @@ -28,7 +28,7 @@ geoflow_action packages = list(), pid_generator = NULL, generic_uploader = FALSE, - fun = function(config, entity){}, + fun = function(action, entity, config){}, available_options = list( option_name = list(def = "option description", default = FALSE) ),