From 57c817470d19536529052b9f571bdd959fecc6ea Mon Sep 17 00:00:00 2001 From: wlandau Date: Mon, 15 May 2023 10:17:50 -0400 Subject: [PATCH] Fail early in poll() --- DESCRIPTION | 2 +- R/crew_router.R | 12 ++++++++++-- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 3347a5aa..78178736 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -16,7 +16,7 @@ Description: In computationally demanding analysis projects, 'clustermq' by Schubert (2019) ), and 'batchtools' by Lang, Bischel, and Surmann (2017) . -Version: 0.1.1.9006 +Version: 0.1.1.9008 License: MIT + file LICENSE URL: https://wlandau.github.io/crew/, https://github.com/wlandau/crew BugReports: https://github.com/wlandau/crew/issues diff --git a/R/crew_router.R b/R/crew_router.R index a09dc660..a8c5c04d 100644 --- a/R/crew_router.R +++ b/R/crew_router.R @@ -217,10 +217,18 @@ crew_class_router <- R6::R6Class( #' of high-level worker-specific statistics. #' @return `NULL` (invisibly). poll = function() { + if (!isTRUE(self$started)) { + return(invisible()) + } out <- mirai::daemons(.compute = self$name)$daemons - if (daemons_valid(out)) { - self$daemons <- out + # Should not happen: + # nocov start + if (!daemons_valid(out)) { + message <- paste(c("invalid daemons:", deparse1(out)), collapse = " ") + crew_error(message) } + # nocov end + self$daemons <- out invisible() }, #' @description Show an informative worker log.