diff --git a/DESCRIPTION b/DESCRIPTION index f4171003..b8e3c64c 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Package: mirai Type: Package Title: Minimalist Async Evaluation Framework for R -Version: 1.2.0.9016 +Version: 1.2.0.9017 Description: Designed for simplicity, a 'mirai' evaluates an R expression asynchronously in a parallel process, locally or distributed over the network, with the result automatically available upon completion. Modern diff --git a/NEWS.md b/NEWS.md index aad5a0fb..29f7924a 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,9 +1,10 @@ -# mirai 1.2.0.9016 (development) +# mirai 1.2.0.9017 (development) * `daemons(dispatcher = NA)` now provides access to threaded dispatcher (experimental). This implements dispatcher using a thread rather than an external process and is faster and more efficient. * `daemons()` behavioural changes: - Return value is now always an integer value - either the number of daemons set if using dispatcher, or the number of daemons launched locally (zero if using a remote launcher). - Gains argument 'force' to control whether calls to `daemons()` resets previous settings for the same compute profile. + - Invalid type of '...' arguments are now dropped instead of throwing an error. This allows '...' containing unused arguments to be more easily passed from other functions. * `mirai_map()` behavioural changes: - Combining multiple collection options becomes easier, allowing for instance `x[.stop, .progress]`. - Adds `mirai_map()[.progress_cli]` as an alternative progress indicator, using the 'cli' package to show % complete and ETA. diff --git a/R/daemons.R b/R/daemons.R index e4bdbe8d..6d79cf24 100644 --- a/R/daemons.R +++ b/R/daemons.R @@ -627,10 +627,9 @@ req_socket <- function(url, tls = NULL, resend = 0L) `opt<-`(socket(protocol = "req", listen = url, tls = tls), "req:resend-time", resend) parse_dots <- function(...) { - missing(...) && return("") + ...length() || return("") dots <- list(...) - for (dot in dots) - is.numeric(dot) || is.logical(dot) || stop(._[["wrong_dots"]], call. = FALSE) + dots <- dots[as.logical(lapply(dots, function(x) is.numeric(x) | is.logical(x)))] dnames <- names(dots) out <- sprintf(",%s", paste(dnames, dots, sep = "=", collapse = ",")) pos <- dnames == "output" diff --git a/R/mirai-package.R b/R/mirai-package.R index 4f68ebcf..062b47bf 100644 --- a/R/mirai-package.R +++ b/R/mirai-package.R @@ -103,8 +103,7 @@ requires_local = "ssh_config(): SSH tunnelling requires 'url' hostname to be '127.0.0.1' or 'localhost'", single_url = "only one 'url' should be specified", sync_timeout = "initial sync with dispatcher/daemon timed out after 10s", - url_spec = "launch_*(): numeric value for 'url' is out of bounds", - wrong_dots = "daemons(): '...' arguments should only be of integer, numeric or logical type" + url_spec = "launch_*(): numeric value for 'url' is out of bounds" ), hash = TRUE ) diff --git a/tests/tests.R b/tests/tests.R index ae3e57ff..cff28857 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -25,7 +25,6 @@ nanotesterr(daemons(url = "URL"), "Invalid argument") nanotesterr(daemons(-1), "zero or greater") nanotesterr(daemons(n = 0, url = "ws://localhost:0"), "1 or greater") nanotesterr(daemons(raw(0L)), "must be numeric") -nanotesterr(daemons(n = 1, maxtasks = "100"), "'...' arguments") nanotesterr(dispatcher(client = "URL"), "at least one") nanotesterr(daemon("URL"), "Invalid argument") nanotest(is.character(mlc <- launch_remote("ws://[::1]:5555"))) @@ -196,7 +195,7 @@ connection && { # advanced daemons and dispatcher tests connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == "true" && { Sys.sleep(1L) - nanotesto(daemons(url = local_url(), dispatcher = TRUE)) + nanotesto(daemons(url = local_url(), dispatcher = TRUE, notused = "wrongtype")) nanotest(grepl("://", launch_remote(1L), fixed = TRUE)) nanotestn(launch_local(nextget("urls"))) Sys.sleep(1L) @@ -212,9 +211,9 @@ connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == " } Sys.sleep(1L) nanotestz(daemons(NULL)) - nanotesto(daemons(url = "ws://:0", token = TRUE)) + nanotesto(daemons(url = "ws://:0", correctype = 0L, token = TRUE)) nanotestz(daemons(0L)) - nanotestz(with(daemons(url = "tcp://:0", token = TRUE), {8L - 9L + 1L})) + nanotestz(with(daemons(url = "tcp://:0", correcttype = 1, token = TRUE), {8L - 9L + 1L})) nanotest(daemons(n = 2, "ws://:0") == 2L) nanotest(is.integer(nextget("pid"))) nanotest(length(nextget("urls")) == 2L) @@ -237,7 +236,7 @@ connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == " nanotest(is.character(saisei(i = 1L, force = TRUE))) nanotestn(saisei(i = 10L)) nanotestz(daemons(0)) - nanotest(daemons(n = 2, "tcp://127.0.0.1:45555") == 2L) + nanotest(daemons(n = 2, "tcp://127.0.0.1:45555", correcttype = NA) == 2L) Sys.sleep(1L) nanotestn(launch_local(nextget("urls", .compute = "default")[1L], maxtasks = 1L)) nanotestn(launch_local(2, maxtasks = 1L))