Skip to content

Commit

Permalink
retain stats until node re-connects
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Mar 7, 2023
1 parent b5b27da commit 3777610
Show file tree
Hide file tree
Showing 4 changed files with 10 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.7.2.9027
Version: 0.7.2.9028
Description: Lightweight parallel code execution, local or distributed across
the network. Designed for simplicity, a 'mirai' evaluates an arbitrary
expression asynchronously, resolving automatically upon completion.
Expand Down
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mirai 0.7.2.9027 (development)
# mirai 0.7.2.9028 (development)

* mirai 0.8.0 is a major feature release. Special thanks to @wlandau for suggestions, discussion and testing for many of the new capabilities.
* Compute profiles have been introduced through a new `.compute` argument in `daemons()` and `mirai()` for sending tasks with heterogeneous compute requirements.
Expand Down
11 changes: 7 additions & 4 deletions R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ server <- function(url, nodes = NULL, idletime = Inf, walltime = Inf, tasklimit
vectorised <- length(url) == nodes + 2L
seq_nodes <- seq_len(nodes)
servernames <- character(nodes)
complete <- assigned <- integer(nodes)
activestore <- complete <- assigned <- integer(nodes)
serverfree <- !integer(nodes)
servers <- queue <- vector(mode = "list", length = nodes)

Expand Down Expand Up @@ -140,8 +140,11 @@ server <- function(url, nodes = NULL, idletime = Inf, walltime = Inf, tasklimit
while (count < tasklimit && mclock() - start < walltime && if (idle) mclock() - idle < idletime else TRUE) {

activevec <- as.integer(unlist(lapply(servers, stat, "pipes")))
assigned <- activevec * assigned
complete <- activevec * complete
newcon <- as.logical(pmax.int(activevec - activestore, 0L))
activestore <- activevec
assigned[newcon] <- 0L
complete[newcon] <- 0L

active <- sum(activevec)
free <- which(serverfree & activevec)
if (length(free) == active) {
Expand Down Expand Up @@ -379,7 +382,7 @@ mirai <- function(.expr, ..., .args = list(), .timeout = NULL, .compute = "defau
#' running a passive queue.}
#' \item{\code{nodes}} {- a matrix of URL, active (connected) and busy
#' status, as well as cumulative tasks assigned and completed (reset if a
#' node disconnects), or else NA if not running an active queue.}
#' node re-connects), or else NA if not running an active queue.}
#' }
#'
#' @details Use \code{daemons(0)} to reset all daemon connections at any time.
Expand Down
2 changes: 1 addition & 1 deletion man/daemons.Rd

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

0 comments on commit 3777610

Please sign in to comment.