diff --git a/R/daemons.R b/R/daemons.R index 000adf7c..416ffa5f 100644 --- a/R/daemons.R +++ b/R/daemons.R @@ -539,6 +539,9 @@ parse_tls <- function(tls) libp <- function(lp = .libPaths()) lp[file.exists(file.path(lp, "mirai"))][1L] +wa31 <- function(url, dots, rs, tls = NULL) + shQuote(sprintf("mirai::daemon(\"%s\"%s%s,rs=c(%s))", url, dots, parse_tls(tls), paste0(rs, collapse = ","))) + wa3 <- function(url, dots, rs, tls = NULL) shQuote(sprintf("mirai::daemon(\"%s\"%s%s,rs=c(%s),dispatcher=FALSE)", url, dots, parse_tls(tls), paste0(rs, collapse = ","))) diff --git a/R/dispatcher.R b/R/dispatcher.R index 6d5ff871..61317d6f 100644 --- a/R/dispatcher.R +++ b/R/dispatcher.R @@ -348,7 +348,7 @@ v1_dispatcher <- function(host, url = NULL, n = NULL, ..., retry = FALSE, } } - auto && launch_daemon(wa3(nurl, dots, next_stream(envir)), output) + auto && launch_daemon(wa31(nurl, dots, next_stream(envir)), output) basenames[i] <- burl servernames[i] <- listurl diff --git a/tests/tests.R b/tests/tests.R index d603484a..2d73275e 100644 --- a/tests/tests.R +++ b/tests/tests.R @@ -320,18 +320,16 @@ connection && Sys.getenv("NOT_CRAN") == "true" && { Sys.sleep(1L) option <- 15L Sys.setenv(R_DEFAULT_PACKAGES = "stats,utils") - test_equal(2L, daemons(2, dispatcher = "process", maxtasks = 10L, timerstart = 1L, walltime = 500L, seed = 1546, token = TRUE, cleanup = option, autoexit = tools::SIGCONT)) + test_equal(1L, daemons(1, dispatcher = "process", maxtasks = 10L, timerstart = 1L, walltime = 500L, seed = 1546, token = TRUE, cleanup = option, autoexit = tools::SIGCONT)) Sys.unsetenv("R_DEFAULT_PACKAGES") Sys.sleep(1L) mq <- mirai(runif(1L), .timeout = 1000) test_true(is.numeric(mq[])) mq <- mirai(Sys.sleep(0.7), .timeout = 500) test_class("matrix", status()[["daemons"]]) - test_type("character", saisei(i = 2L, force = TRUE)) - m <- mirai(mirai::daemon(url), url = nextget("urls")[2L]) - Sys.sleep(0.1) test_null(saisei(i = 1L)) - test_type("integer", mirai(1L, .timeout = 500)[]) + test_type("character", saisei(i = 1L, force = TRUE)) + Sys.sleep(0.1) test_zero(daemons(0)) } # additional legacy interface tests @@ -340,10 +338,9 @@ connection && .Platform[["OS.type"]] != "windows" && Sys.getenv("NOT_CRAN") == " test_equal(daemons(url = host_url(ws = TRUE, tls = TRUE), dispatcher = "thread", output = TRUE), 1L) test_equal(nextget("n"), 1L) test_equal(length(nextget("urls")), 1L) - Sys.sleep(1L) test_class("matrix", status()$daemons) test_null(saisei(i = 0L)) - test_type("character", saisei(i = 1L)) + test_print(saisei(i = 1L)) Sys.sleep(0.1) test_zero(daemons(0)) }