Skip to content

Commit

Permalink
align sync method for ephemeral daemons
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Sep 21, 2023
1 parent ca2dced commit d87420b
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions 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.10.0.9006
Version: 0.10.0.9007
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 All @@ -23,5 +23,5 @@ Encoding: UTF-8
Depends:
R (>= 3.5)
Imports:
nanonext (>= 0.10.0.9007)
nanonext (>= 0.10.0.9008)
RoxygenNote: 7.2.3
4 changes: 2 additions & 2 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
# mirai 0.10.0.9006 (development)
# mirai 0.10.0.9007 (development)

* `daemon()` argument 'exitlinger' retired as daemons now synchronise with the host/dispatcher and exit as soon as possible.
* Optimises scheduling at dispatcher: tasks are no longer assigned to a daemon if it is exiting due to specified time/task-outs.
* Deprecated use of alias `server()` for `daemon()` is retired.
* Requires nanonext >= [0.10.0.9007].
* Requires nanonext >= [0.10.0.9008].

# mirai 0.10.0

Expand Down
10 changes: 5 additions & 5 deletions R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -155,12 +155,12 @@ daemon <- function(url, asyncdial = FALSE, maxtasks = Inf, idletime = Inf,
on.exit(close(sock))
cv <- cv()
pipe_notify(sock, cv = cv, add = FALSE, remove = TRUE, flag = FALSE)
ctx <- .context(sock)
._mirai_. <- recv(ctx, mode = 1L)
._mirai_. <- recv(sock, mode = 1L, block = TRUE)
data <- tryCatch(eval(expr = ._mirai_.[[".expr"]], envir = ._mirai_., enclos = NULL),
error = mk_mirai_error, interrupt = mk_interrupt_error)
send(ctx, data = data, mode = 1L)
until(cv, .timelimit)
send(sock, data = data, mode = 1L, block = TRUE)
data <- recv_aio_signal(sock, cv = cv, mode = 8L)
wait(cv)

}

Expand Down Expand Up @@ -529,7 +529,7 @@ mirai <- function(.expr, ..., .args = list(), .timeout = NULL, .compute = "defau
url <- auto_tokenized_url()
sock <- req_socket(url)
if (length(.timeout)) launch_and_sync_daemon(sock = sock, url) else launch_daemon(url)
aio <- request(.context(sock), data = envir, send_mode = 1L, recv_mode = 1L, timeout = .timeout, autoclose = TRUE)
aio <- request(.context(sock), data = envir, send_mode = 1L, recv_mode = 1L, timeout = .timeout, ack = TRUE)
`attr<-`(.subset2(aio, "aio"), "sock", sock)

}
Expand Down

0 comments on commit d87420b

Please sign in to comment.