Skip to content

Commit

Permalink
Fix #67
Browse files Browse the repository at this point in the history
  • Loading branch information
wlandau-lilly committed Apr 27, 2023
1 parent 5c8858e commit b26c488
Show file tree
Hide file tree
Showing 8 changed files with 33 additions and 63 deletions.
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
Expand Up @@ -45,8 +45,7 @@ Imports:
stats,
tibble,
tidyselect,
utils,
withr
utils
Suggests:
knitr (>= 1.30),
markdown (>= 1.1),
Expand Down
1 change: 0 additions & 1 deletion NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -62,4 +62,3 @@ importFrom(tidyselect,one_of)
importFrom(tidyselect,starts_with)
importFrom(utils,globalVariables)
importFrom(utils,head)
importFrom(withr,local_seed)
1 change: 1 addition & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# crew 0.1.1.9000 (development)

* Use `.args` instead of `...` in `mirai::mirai()`.
* Use `set.seed()` instead of `withr::local_seed()` (#67, @shikokuchuo).

# crew 0.1.1

Expand Down
7 changes: 4 additions & 3 deletions R/crew_eval.R
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,9 @@
#' @param globals Named list of objects to temporarily assign to the
#' global environment for the task.
#' @param seed Integer of length 1 with the pseudo-random number generator
#' seed to temporarily set for the evaluation of the task.
#' At the end of the task, the seed is restored.
#' seed to set for the evaluation of the task. Does not restore
#' the original seed, but this is okay because `crew_eval()`
#' should only run in a non-interactive worker process.
#' @param packages Character vector of packages to load for the task.
#' @param library Library path to load the packages. See the `lib.loc`
#' argument of `require()`.
Expand All @@ -30,7 +31,7 @@ crew_eval <- function(
library = NULL
) {
load_packages(packages = packages, library = library)
withr::local_seed(seed)
set.seed(seed)
list2env(x = globals, envir = globalenv())
envir <- list2env(x = data, parent = globalenv())
capture_error <- function(condition) {
Expand Down
1 change: 0 additions & 1 deletion R/crew_package.R
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,6 @@
#' @importFrom tidyselect all_of any_of contains ends_with eval_select
#' everything last_col matches num_range one_of starts_with
#' @importFrom utils globalVariables head
#' @importFrom withr local_seed
NULL

utils::globalVariables(".")
75 changes: 22 additions & 53 deletions codemeta.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
"@context": "https://doi.org/10.5063/schema/codemeta-2.0",
"@type": "SoftwareSourceCode",
"identifier": "crew",
"description": "In computationally demanding analysis projects, statisticians and data scientists asynchronously deploy long-running tasks to distributed systems, ranging from traditional clusters to cloud services The 'NNG'-powered 'mirai' R package by Gao (2023) <https://CRAN.R-project.org/package=mirai> is a sleek and sophisticated scheduler that efficiently processes these intense workloads. The 'crew' package extends 'mirai' with a unifying interface for third-party worker launchers. Inspiration also comes from packages 'future' by Bengtsson (2021) <doi:10.32614/RJ-2021-048>, 'rrq' by FitzJohn and Ashton (2023) <https://github.com/mrc-ide/rrq>, 'clustermq' by Schubert (2019) <doi:10.1093/bioinformatics/btz284>), and 'batchtools' by Lang, Bischel, and Surmann (2017) <doi:10.21105/joss.00135>.",
"description": "In computationally demanding analysis projects, statisticians and data scientists asynchronously deploy long-running tasks to distributed systems, ranging from traditional clusters to cloud services. The 'NNG'-powered 'mirai' R package by Gao (2023) <https://CRAN.R-project.org/package=mirai> is a sleek and sophisticated scheduler that efficiently processes these intense workloads. The 'crew' package extends 'mirai' with a unifying interface for third-party worker launchers. Inspiration also comes from packages. 'future' by Bengtsson (2021) <doi:10.32614/RJ-2021-048>, 'rrq' by FitzJohn and Ashton (2023) <https://github.com/mrc-ide/rrq>, 'clustermq' by Schubert (2019) <doi:10.1093/bioinformatics/btz284>), and 'batchtools' by Lang, Bischel, and Surmann (2017) <doi:10.21105/joss.00135>.",
"name": "crew: A Distributed Worker Launcher",
"relatedLink": ["https://wlandau.github.io/crew/", "https://CRAN.R-project.org/package=crew"],
"codeRepository": "https://github.com/wlandau/crew",
"issueTracker": "https://github.com/wlandau/crew/issues",
"license": "https://spdx.org/licenses/MIT",
"version": "0.0.5.9000",
"version": "0.1.1.9000",
"programmingLanguage": {
"@type": "ComputerLanguage",
"name": "R",
"url": "https://r-project.org"
},
"runtimePlatform": "R version 4.2.2 (2022-10-31)",
"runtimePlatform": "R version 4.2.3 (2023-03-15)",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand Down Expand Up @@ -72,18 +72,6 @@
},
"sameAs": "https://CRAN.R-project.org/package=markdown"
},
{
"@type": "SoftwareApplication",
"identifier": "processx",
"name": "processx",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=processx"
},
{
"@type": "SoftwareApplication",
"identifier": "rmarkdown",
Expand Down Expand Up @@ -116,21 +104,9 @@
"@type": "SoftwareApplication",
"identifier": "R",
"name": "R",
"version": ">= 3.5.0"
"version": ">= 4.0.0"
},
"2": {
"@type": "SoftwareApplication",
"identifier": "callr",
"name": "callr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=callr"
},
"3": {
"@type": "SoftwareApplication",
"identifier": "getip",
"name": "getip",
Expand All @@ -142,11 +118,11 @@
},
"sameAs": "https://CRAN.R-project.org/package=getip"
},
"4": {
"3": {
"@type": "SoftwareApplication",
"identifier": "mirai",
"name": "mirai",
"version": ">= 0.8.1",
"version": ">= 0.8.3",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -155,11 +131,11 @@
},
"sameAs": "https://CRAN.R-project.org/package=mirai"
},
"5": {
"4": {
"@type": "SoftwareApplication",
"identifier": "nanonext",
"name": "nanonext",
"version": ">= 0.8.1",
"version": ">= 0.8.2",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
Expand All @@ -168,19 +144,19 @@
},
"sameAs": "https://CRAN.R-project.org/package=nanonext"
},
"6": {
"5": {
"@type": "SoftwareApplication",
"identifier": "parallelly",
"name": "parallelly",
"identifier": "processx",
"name": "processx",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=parallelly"
"sameAs": "https://CRAN.R-project.org/package=processx"
},
"7": {
"6": {
"@type": "SoftwareApplication",
"identifier": "ps",
"name": "ps",
Expand All @@ -192,7 +168,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=ps"
},
"8": {
"7": {
"@type": "SoftwareApplication",
"identifier": "R6",
"name": "R6",
Expand All @@ -204,7 +180,7 @@
},
"sameAs": "https://CRAN.R-project.org/package=R6"
},
"9": {
"8": {
"@type": "SoftwareApplication",
"identifier": "rlang",
"name": "rlang",
Expand All @@ -216,6 +192,11 @@
},
"sameAs": "https://CRAN.R-project.org/package=rlang"
},
"9": {
"@type": "SoftwareApplication",
"identifier": "stats",
"name": "stats"
},
"10": {
"@type": "SoftwareApplication",
"identifier": "tibble",
Expand Down Expand Up @@ -245,24 +226,12 @@
"identifier": "utils",
"name": "utils"
},
"13": {
"@type": "SoftwareApplication",
"identifier": "withr",
"name": "withr",
"provider": {
"@id": "https://cran.r-project.org",
"@type": "Organization",
"name": "Comprehensive R Archive Network (CRAN)",
"url": "https://cran.r-project.org"
},
"sameAs": "https://CRAN.R-project.org/package=withr"
},
"SystemRequirements": null
},
"fileSize": "548.372KB",
"fileSize": "558.306KB",
"releaseNotes": "https://github.com/wlandau/crew/blob/master/NEWS.md",
"readme": "https://github.com/wlandau/crew/blob/main/README.md",
"contIntegration": ["https://github.com/wlandau/crew/actions?query=workflow%3Acheck", "https://app.codecov.io/gh/wlandau/crew", "https://github.com/wlandau/crew/actions?query=workflow%3Alint"],
"developmentStatus": "https://www.repostatus.org/#Active",
"keywords": ["r-package", "r", "rstats", "workflow", "high-performance-computing"]
"keywords": ["r-package", "r", "rstats", "high-performance-computing"]
}
5 changes: 3 additions & 2 deletions man/crew_eval.Rd

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

3 changes: 2 additions & 1 deletion tests/testthat/test-crew_controller_local.R
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ crew_test("crew_controller_local()", {
)
x$wait(seconds_timeout = 5)
out <- x$pop()
exp <- withr::with_seed(0L, paste0("abc", sample.int(n = 1e9L, size = 1L)))
set.seed(0L)
exp <- paste0("abc", sample.int(n = 1e9L, size = 1L))
expect_equal(out$result[[1]], exp)
expect_equal(out$error, NA_character_)
expect_false(exists(x = ".crew_y", envir = globalenv()))
Expand Down

0 comments on commit b26c488

Please sign in to comment.