Skip to content

Commit

Permalink
cleanups
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Dec 30, 2023
1 parent b8edac1 commit 5d9bd0d
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 7 deletions.
1 change: 0 additions & 1 deletion R/daemon.R
Original file line number Diff line number Diff line change
Expand Up @@ -214,4 +214,3 @@ perform_cleanup <- function(cleanup) {
}

snapshot <- function() `[[<-`(`[[<-`(`[[<-`(., "op", .Options), "se", search()), "vars", names(.GlobalEnv))

2 changes: 1 addition & 1 deletion R/dispatcher.R
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ dispatcher <- function(host, url = NULL, n = NULL, ..., asyncdial = FALSE,
}

envir <- new.env(hash = FALSE)
if (length(rs)) `[[<-`(envir, "stream", as.integer(rs))
if (is.numeric(rs)) `[[<-`(envir, "stream", as.integer(rs))

for (i in seq_n) {
burl <- if (auto) .urlscheme else
Expand Down
7 changes: 2 additions & 5 deletions R/parallel.R
Original file line number Diff line number Diff line change
Expand Up @@ -97,11 +97,11 @@
make_cluster <- function(n, url = NULL, remote = NULL, ...) {

id <- sprintf("`%d`", length(..))
cv2 <- cv()

if (is.character(url)) {

length(url) == 1L || stop(._[["single_url"]])
cv2 <- cv()
daemons(url = url, remote = remote, dispatcher = FALSE, resilience = FALSE, cleanup = FALSE, ..., .compute = id)

if (length(remote)) {
Expand All @@ -117,7 +117,6 @@ make_cluster <- function(n, url = NULL, remote = NULL, ...) {
} else {
is.numeric(n) || stop(._[["numeric_n"]])
n >= 1L || stop(._[["n_one"]])
cv2 <- cv()
daemons(n = n, dispatcher = FALSE, resilience = FALSE, cleanup = FALSE, ..., .compute = id)
}

Expand Down Expand Up @@ -159,12 +158,10 @@ sendData.miraiNode <- function(node, data) {

value <- data[["data"]]
tagged <- !is.null(value[["tag"]])
tagged && { envir[["swapped"]] || cv_swap(envir, TRUE) } || { envir[["swapped"]] && cv_swap(envir, FALSE) }
tagged && (envir[["swapped"]] || cv_swap(envir, TRUE)) || (envir[["swapped"]] && cv_swap(envir, FALSE))

m <- mirai(do.call(node, data, quote = TRUE), node = value[["fun"]], data = value[["args"]], .compute = id)

if (tagged) assign("tag", value[["tag"]], m)

`[[<-`(node, "mirai", m)

}
Expand Down

0 comments on commit 5d9bd0d

Please sign in to comment.