File: BatchtoolsFuture%2Cgc.R

package info (click to toggle)
r-cran-future.batchtools 0.12.1%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: sid, trixie
  • size: 528 kB
  • sloc: sh: 82; makefile: 2
file content (35 lines) | stat: -rw-r--r-- 759 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
source("incl/start.R")

message("*** BatchtoolsFuture() and garbage collection ...")

plan(batchtools_local)

for (how in c("resolve", "value")) {
  f <- future({ 1 })

  if (how == "value") {
    v <- value(f)
    print(v)
  } else if (how == "resolve") {
    resolve(f)
  }

  stopifnot(resolved(f))

  reg <- f$config$reg

  ## Force removal of batchtools registry files
  rm(list = "f")
  gc()

  ## Assert removal of files only happens if there was not
  ## a failure and option future.delete is not TRUE.
  stopifnot(!file_test("-d", reg$file.dir))
  fail <- try(checkIds(reg, ids = 1L), silent = TRUE)
  stopifnot(inherits(fail, "try-error"))
} ## for (how ...)


message("*** BatchtoolsFuture() and garbage collection ... DONE")

source("incl/end.R")