Skip to content

Commit

Permalink
do not special case ephemeral mirai with timeouts
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Dec 6, 2023
1 parent 069815b commit 77f32a4
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion DESCRIPTION
Original file line number Diff line number Diff line change
@@ -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.
Expand Down
6 changes: 3 additions & 3 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
# 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.
* Simplification of `mirai()` interface:
+ '.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.

Expand Down
4 changes: 1 addition & 3 deletions R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down Expand Up @@ -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))

0 comments on commit 77f32a4

Please sign in to comment.