From 77f32a45742ac212a7c6f69806fc58b57ad5647c Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Wed, 6 Dec 2023 09:41:42 +0000 Subject: [PATCH] do not special case ephemeral mirai with timeouts --- DESCRIPTION | 2 +- NEWS.md | 6 +++--- R/mirai.R | 4 +--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index bfe5a7361..e4f90b0b8 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mirai Type: Package Title: Minimalist Async Evaluation Framework for R -Version: 0.11.2.9025 +Version: 0.11.2.9026 Description: Lightweight parallel code execution and distributed computing. Designed for simplicity, a 'mirai' evaluates an R expression asynchronously, on local or network resources, resolving automatically upon completion. diff --git a/NEWS.md b/NEWS.md index d4d2faf3f..4189904d6 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,4 +1,4 @@ -# mirai 0.11.2.9025 (development) +# mirai 0.11.2.9026 (development) * Implements `serialization()` for registering custom serialization and unserialization functions when using daemons. * Introduces `call_mirai_()`, a user-interruptible version of `call_mirai()` suitable for interactive use. @@ -6,9 +6,9 @@ + '.args' will now coerece to a list if an object other than a list is supplied, rather than error. + '.signal' argument removed - now all 'mirai' signal if daemons are set up. * `everywhere()` now returns invisible NULL in the case the specified compute profile is not set up, rather than error. -* `make_cluster()` now always prints daemon launch commands where 'url' is specified without 'remote', not only in interactive sessions. +* `make_cluster()` now prints daemon launch commands where 'url' is specified without 'remote' whether or not interactive. +* `mirai()` specifying a timeout when `daemons()` has not been set - the timeout begins immediately rather than after the ephemeral daemon has connected - please factor in a small amount of time for the daemon to launch. * Improved memory efficiency and stability at dispatcher. -* Improved error messages and handling for daemon/dispatcher connection errors. * No longer loads the 'promises' package if not already loaded (but makes the 'mirai' method available via a hook function). * Requires nanonext >= 0.11.0. diff --git a/R/mirai.R b/R/mirai.R index 99e402615..686a2e8fc 100644 --- a/R/mirai.R +++ b/R/mirai.R @@ -157,7 +157,7 @@ mirai <- function(.expr, ..., .args = list(), .timeout = NULL, .compute = "defau } else { url <- auto_tokenized_url() sock <- req_socket(url, resend = 0L) - length(.timeout) && { launch_and_sync_daemon(sock = sock, url) || return(.connection_error) } || launch_daemon(url) + launch_daemon(url) aio <- request(.context(sock), data = data, send_mode = 1L, recv_mode = 1L, timeout = .timeout) `attr<-`(.subset2(aio, "aio"), "sock", sock) @@ -461,8 +461,6 @@ mk_mirai_error <- function(e) { snapshot <- function() `[[<-`(`[[<-`(`[[<-`(., 'vars', names(.GlobalEnv)), 'se', search()), 'op', .Options) -.connection_error <- list(data = `class<-`(6L, c("errorValue", "try-error")), - value = `class<-`(6L, c("errorValue", "try-error"))) .interrupt_error <- `class<-`("", c("miraiInterrupt", "errorValue", "try-error")) .snapshot <- expression(mirai:::snapshot()) .timedelay <- expression(nanonext::msleep(500L))