Skip to content

Commit

Permalink
consistent environment hierarchies
Browse files Browse the repository at this point in the history
  • Loading branch information
shikokuchuo committed Sep 27, 2023
1 parent 0364a1a commit 444ebea
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 5 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.10.0.9014
Version: 0.10.0.9015
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
2 changes: 1 addition & 1 deletion NEWS.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# mirai 0.10.0.9014 (development)
# mirai 0.10.0.9015 (development)

* Implements an alternative communications backend for R, adding methods for the 'parallel' base package.
+ `make_cluster()` creates a 'miraiCluster', compatible with existing functions taking a 'cluster' object.
Expand Down
3 changes: 2 additions & 1 deletion R/mirai-package.R
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,8 @@ NULL

.onLoad <- function(libname, pkgname) {

.. <<- `[[<-`(new.env(hash = FALSE), "default", new.env(hash = FALSE))
.. <<- new.env(hash = FALSE, parent = environment(daemons))
`[[<-`(.., "default", new.env(hash = FALSE, parent = ..))
switch(
Sys.info()[["sysname"]],
Linux = {
Expand Down
4 changes: 2 additions & 2 deletions R/mirai.R
Original file line number Diff line number Diff line change
Expand Up @@ -785,7 +785,7 @@ daemons <- function(n, url = NULL, dispatcher = TRUE, resilience = TRUE,

envir <- ..[[.compute]]
if (is.null(envir))
envir <- `[[<-`(.., .compute, new.env(hash = FALSE, parent = environment(daemons)))[[.compute]]
envir <- `[[<-`(.., .compute, new.env(hash = FALSE, parent = ..))[[.compute]]

if (is.character(url)) {

Expand Down Expand Up @@ -828,7 +828,7 @@ daemons <- function(n, url = NULL, dispatcher = TRUE, resilience = TRUE,
reap(envir[["sock"]])
length(envir[["sockc"]]) && reap(envir[["sockc"]])
envir <- NULL
`[[<-`(.., .compute, new.env(hash = FALSE))
`[[<-`(.., .compute, new.env(hash = FALSE, parent = ..))

} else if (is.null(envir[["sock"]])) {

Expand Down

0 comments on commit 444ebea

Please sign in to comment.