From e1a41708e5fba07ca7d0135ea9007c5b63cb1f07 Mon Sep 17 00:00:00 2001 From: shikokuchuo <53399081+shikokuchuo@users.noreply.github.com> Date: Wed, 17 Jan 2024 19:04:44 +0000 Subject: [PATCH] widen default timeouts --- NEWS.md | 4 +++- R/dispatcher.R | 2 +- R/launchers.R | 7 ++++--- R/mirai-package.R | 4 ++-- R/mirai.R | 2 +- man/remote_config.Rd | 7 ++++--- 6 files changed, 15 insertions(+), 11 deletions(-) diff --git a/NEWS.md b/NEWS.md index 27a84a95c..f178f9bde 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,6 +1,8 @@ # mirai 0.12.0.9000 (development) -* Fixes `daemons()` specifying 'output = FALSE' being taken as TRUE. +* Dispatcher sync (and status) timeouts widened to 10s to allow for launching large numbers of daemons. +* Default for `ssh_config()` argument 'timeout' widened to 10 (seconds). +* Fixes `daemons()` specifying 'output = FALSE' registering as TRUE instead. * Fixes use of `everywhere()` specifying '.args' as an unnamed list or '.expr' as a language object. # mirai 0.12.0 diff --git a/R/dispatcher.R b/R/dispatcher.R index b73125896..d0d756ddc 100644 --- a/R/dispatcher.R +++ b/R/dispatcher.R @@ -324,7 +324,7 @@ sub_real_port <- function(port, url) sub("(?<=:)0(?![^/])", port, url, perl = TR query_dispatcher <- function(sock, command, mode) { send(sock, data = command, mode = 2L, block = .timelimit) - recv(sock, mode = mode, block = .timelimit + .timelimit) + recv(sock, mode = mode, block = .timelimit) } create_req <- function(ctx, cv) diff --git a/R/launchers.R b/R/launchers.R index 5d0f574aa..0172baba0 100644 --- a/R/launchers.R +++ b/R/launchers.R @@ -214,7 +214,8 @@ remote_config <- function(command = NULL, args = c("", "."), rscript = "Rscript" #' @param remotes the character URL or vector of URLs to SSH into, using the #' 'ssh://' scheme and including the port open for SSH connections (defaults #' to 22 if not specified), e.g. 'ssh://10.75.32.90:22' or 'ssh://nodename'. -#' @param timeout [default 5] maximum time allowed for connection setup in seconds. +#' @param timeout [default 10] maximum time allowed for connection setup in +#' seconds. #' @param tunnel [default FALSE] logical value whether to use SSH reverse #' tunnelling. If TRUE, a tunnel is created between the same ports (as #' specified in 'url') on the local and remote machines. Setting to TRUE @@ -251,7 +252,7 @@ remote_config <- function(command = NULL, args = c("", "."), rscript = "Rscript" #' respective machines. #' #' @examples -#' ssh_config(remotes = c("ssh://10.75.32.90:222", "ssh://nodename"), timeout = 10) +#' ssh_config(remotes = c("ssh://10.75.32.90:222", "ssh://nodename"), timeout = 5) #' #' \dontrun{ #' @@ -282,7 +283,7 @@ remote_config <- function(command = NULL, args = c("", "."), rscript = "Rscript" #' @rdname remote_config #' @export #' -ssh_config <- function(remotes, timeout = 5, tunnel = FALSE, command = "ssh", rscript = "Rscript") { +ssh_config <- function(remotes, timeout = 10, tunnel = FALSE, command = "ssh", rscript = "Rscript") { premotes <- lapply(remotes, parse_url) hostnames <- lapply(premotes, .subset2, "hostname") diff --git a/R/mirai-package.R b/R/mirai-package.R index 3837e81c2..d806838ea 100644 --- a/R/mirai-package.R +++ b/R/mirai-package.R @@ -146,7 +146,7 @@ registerPromisesMethods <- function(pkgname, pkgpath) { requires_local = "SSH tunnelling requires 'url' hostname to be '127.0.0.1' or 'localhost'", refhook_invalid = "'refhook' must be a list of 2 functions or NULL", single_url = "only one 'url' should be specified", - sync_timeout = "initial sync with dispatcher timed out after 5s", + sync_timeout = "initial sync with dispatcher timed out after 10s", url_spec = "numeric value for 'url' is out of bounds", wrong_dots = "'...' arguments should only be of integer, numeric or logical type" ), @@ -154,7 +154,7 @@ registerPromisesMethods <- function(pkgname, pkgpath) { ) .intmax <- .Machine[["integer.max"]] -.timelimit <- 5000L +.timelimit <- 10000L as.promise <- NULL recvData <- NULL diff --git a/R/mirai.R b/R/mirai.R index 42098942b..720776651 100644 --- a/R/mirai.R +++ b/R/mirai.R @@ -448,7 +448,7 @@ print.miraiInterrupt <- function(x, ...) { ephemeral_daemon <- function(url = local_url()) { sock <- req_socket(url, resend = 0L) - system2(command = .command, args = c("-e", shQuote(sprintf("mirai::.daemon('%s')", url))), stdout = NULL, stderr = NULL, wait = FALSE) + system2(command = .command, args = c("-e", shQuote(sprintf("mirai::.daemon('%s')", url))), stdout = FALSE, stderr = FALSE, wait = FALSE) sock } diff --git a/man/remote_config.Rd b/man/remote_config.Rd index c559947ea..b921176e5 100644 --- a/man/remote_config.Rd +++ b/man/remote_config.Rd @@ -9,7 +9,7 @@ remote_config(command = NULL, args = c("", "."), rscript = "Rscript") ssh_config( remotes, - timeout = 5, + timeout = 10, tunnel = FALSE, command = "ssh", rscript = "Rscript" @@ -37,7 +37,8 @@ should be replaced with 'Rscript.exe'.} 'ssh://' scheme and including the port open for SSH connections (defaults to 22 if not specified), e.g. 'ssh://10.75.32.90:22' or 'ssh://nodename'.} -\item{timeout}{[default 5] maximum time allowed for connection setup in seconds.} +\item{timeout}{[default 10] maximum time allowed for connection setup in +seconds.} \item{tunnel}{[default FALSE] logical value whether to use SSH reverse tunnelling. If TRUE, a tunnel is created between the same ports (as @@ -92,7 +93,7 @@ A list in the required format to be supplied to the 'remote' argument \examples{ remote_config(command = "ssh", args = c("-fTp 22 10.75.32.90", ".")) -ssh_config(remotes = c("ssh://10.75.32.90:222", "ssh://nodename"), timeout = 10) +ssh_config(remotes = c("ssh://10.75.32.90:222", "ssh://nodename"), timeout = 5) \dontrun{