Skip to content

Commit

Permalink
make assigned and complete counters cumulative
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Jun 21, 2023
1 parent 2200fac commit 1251a54
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 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.8.7.9028
Version: 0.8.7.9029
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
3 changes: 2 additions & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mirai 0.8.7.9028 (development)
# mirai 0.8.7.9029 (development)

* Allows use of reference objects in a 'mirai' (such as those accessed via an external pointer), by adding argument 'refhook' to `daemons()`, `server()` and `dispatcher()` for providing a hook function to handle such objects.
* Improvements to dispatcher:
Expand All @@ -7,6 +7,7 @@
+ Fixes rare occasions where dispatcher running a single server instance could get stuck with a task.
+ `daemons()` status requests have been rendered more robust.
* Ensures `saisei()` always returns `NULL` if 'tcp://' URLs are being used as they do not support tokens.
* Daemons status matrix 'assigned' and 'complete' are now cumulative statistics, and not reset upon new instances.
* Requires nanonext >= [0.9.0.9004].
* Requires R >= 3.5.0.

Expand Down
10 changes: 3 additions & 7 deletions R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -268,11 +268,8 @@ dispatcher <- function(client, url = NULL, n = NULL, asyncdial = FALSE, token =
activevec <- cv_values %% 2L
changes <- (activevec - activestore) > 0L
activestore <- activevec
if (any(changes)) {
if (any(changes))
instance[changes] <- instance[changes] + 1L
assigned[changes] <- 0L
complete[changes] <- 0L
}

ctrchannel && !unresolved(cmessage) && {
i <- .subset2(cmessage, "data")
Expand Down Expand Up @@ -659,10 +656,9 @@ mirai <- function(.expr, ..., .args = list(), .timeout = NULL, .compute = "defau
#' server has yet to connect or has disconnected.
#'
#' 'instance' increments by 1 every time there is a new connection at a URL.
#' When this happens, the 'assigned' and 'complete' statistics reset to zero.
#' This counter is designed to track new server instances connecting after
#' previous ones have ended (due to time-outs etc.). 'instance' itself
#' resets to zero if the URL is regenerated by \code{\link{saisei}}.
#' previous ones have ended (due to time-outs etc.). 'instance' resets to
#' zero if the URL is regenerated by \code{\link{saisei}}.
#'
#' 'assigned' shows the cumulative number of tasks assigned to the server
#' instance by the dispatcher.
Expand Down
5 changes: 2 additions & 3 deletions man/daemons.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 1251a54

Please sign in to comment.