From 8f2677d8a5ec91628fe65facd52b4cd5a5422402 Mon Sep 17 00:00:00 2001 From: mschubert Date: Wed, 29 Nov 2017 17:01:52 +0100 Subject: [PATCH] add verbose flag (closes #61) --- R/qsys_multicore.r | 2 +- R/worker.r | 6 +++++- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/R/qsys_multicore.r b/R/qsys_multicore.r index 25779e1b..8a9f50d3 100644 --- a/R/qsys_multicore.r +++ b/R/qsys_multicore.r @@ -16,7 +16,7 @@ MULTICORE = R6::R6Class("MULTICORE", # fun = clustermq:::worker, # master = values$master) - cmd = quote(clustermq:::worker(private$master)) + cmd = quote(clustermq:::worker(private$master, verbose=FALSE)) for (i in seq_len(n_jobs)) { p = parallel::mcparallel(cmd, silent=TRUE, detached=TRUE) private$pids = c(private$pids, p$pid) diff --git a/R/worker.r b/R/worker.r index cf6c43ea..5c123cc1 100644 --- a/R/worker.r +++ b/R/worker.r @@ -5,7 +5,11 @@ #' @param master The master address (tcp://ip:port) #' @param timeout Time until worker shuts down without hearing from master #' @param ... Catch-all to not break older template values (ignored) -worker = function(master, timeout=600, ...) { +#' @param verbose Whether to print debug messages +worker = function(master, timeout=600, ..., verbose=TRUE) { + if (!verbose) + message = function(...) invisible(NULL) + message("Master: ", master) if (length(list(...)) > 0) warning("Arguments ignored: ", paste(names(list(...)), collapse=", "))