R Under development (unstable) (2025-06-05 r88281 ucrt) -- "Unsuffered Consequences" Copyright (C) 2025 The R Foundation for Statistical Computing Platform: x86_64-w64-mingw32/x64 R is free software and comes with ABSOLUTELY NO WARRANTY. You are welcome to redistribute it under certain conditions. Type 'license()' or 'licence()' for distribution details. R is a collaborative project with many contributors. Type 'contributors()' for more information and 'citation()' on how to cite R or R packages in publications. Type 'demo()' for some demos, 'help()' for on-line help, or 'help.start()' for an HTML browser interface to help. Type 'q()' to quit R. > source("incl/start.R") Loading required package: parallelly Loading required package: future > > message("*** BatchtoolsFutureError() ...") *** BatchtoolsFutureError() ... > > plan(batchtools_local) > > for (cleanup in c(FALSE, TRUE)) { + mprintf("*** batchtools future error w/ future.delete = %s ...\n", cleanup) + + options(future.delete = cleanup) + + f <- future({ + x <- 1 + print(x) + stop("Woops!") + }) + + resolve(f) + + ## Assert future is listed as resolved + stopifnot(resolved(f)) + + reg <- f$config$reg + ## Force garbage collection of future which will possibly + ## result in the removal of batchtools registry files + + reg.finalizer(f, function(f) { + message("Garbage collecting future ...") + print(f) + message("Garbage collecting future ... DONE") + }, onexit = TRUE) + rm(list = "f") + gc() + message(" - Future removed and garbage collected.") + mprintf(" - batchtools Registry path (%s) exists: %s\n", + sQuote(reg$file.dir), file_test("-d", reg$file.dir)) + + ## Assert removal of files only happens if there was not + ## a failure and option future.delete is not TRUE. + if (!cleanup) { + ## FIXME: Does the new future::FutureResult trigger garbage collection? + stopifnot(file_test("-d", reg$file.dir)) + log <- batchtools::getLog(reg = reg, id = 1L) + print(log) + + ## Now manually delete batchtools Registry + batchtools::removeRegistry(wait = 0.0, reg = reg) + } + + stopifnot(!file_test("-d", reg$file.dir)) + + mprintf("*** batchtools future error w/ future.delete = %s ... DONE\n", cleanup) + } ## for (cleanup ...) *** batchtools future error w/ future.delete = FALSE ... [04:36:55.072] Launched future #1 Garbage collecting future ... BatchtoolsLocalFuture: Label: Expression: { x <- 1 print(x) stop("Woops!") } Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Capture standard output: TRUE Capture condition classes: 'condition' (excluding '') Immediate condition classes: 'immediateCondition' Lazy evaluation: FALSE Local evaluation: TRUE Asynchronous evaluation: TRUE Early signaling: FALSE Environment: R_GlobalEnv State: 'running' Resolved: TRUE Unique identifier: f04c69e06f520cbd8cbb20754d57c57e-2 Owner process: f04c69e06f520cbd8cbb20754d57c57e Class: 'BatchtoolsLocalFuture', 'BatchtoolsUniprocessFuture', 'BatchtoolsFuture', 'Future', 'environment' Value: Conditions captured: batchtools configuration file: 'D:/RCompile/CRANincoming/R-devel/lib/future.batchtools/templates-for-R_CMD_check/batchtools.conf.R' (82 bytes; 1 lines) batchtools cluster functions: 'Interactive' batchtools cluster functions template: batchtools status: 'defined', 'finished', 'started', 'submitted' batchtools Registry: File dir exists: TRUE Work dir exists: TRUE Job Registry Backend : Interactive File dir : D:/temp/2025_06_06_04_35_16_24916/RtmpEjnLum/.future/20250606_043653-EjnLum/batchtools_159184213 Work dir : D:/RCompile/CRANincoming/R-devel/future.batchtools.Rcheck/tests Jobs : 1 Seed : 18186 Writeable: TRUE Garbage collecting future ... DONE Warning in delete.BatchtoolsFuture(f, onRunning = "skip", onMissing = "ignore", : Will not remove batchtools registry, because the status of the batchtools was 'error', 'defined', 'finished', 'started', 'submitted' and option 'future.delete' is FALSE or running in an interactive session: 'D:/temp/2025_06_06_04_35_16_24916/RtmpEjnLum/.future/20250606_043653-EjnLum/batchtools_159184213' - Future removed and garbage collected. - batchtools Registry path ('D:/temp/2025_06_06_04_35_16_24916/RtmpEjnLum/.future/20250606_043653-EjnLum/batchtools_159184213') exists: TRUE [1] "### [bt]: This is batchtools v0.9.17" [2] "### [bt]: Starting calculation of 1 jobs" [3] "### [bt]: Setting working directory to 'D:/RCompile/CRANincoming/R-devel/future.batchtools.Rcheck/tests'" [4] "Loading required package: methods" [5] "### [bt]: Memory measurement disabled" [6] "### [bt]: Starting job [batchtools job.id=1]" [7] "### [bt]: Setting seed to 18187 ..." [8] "" [9] "### [bt]: Job terminated successfully [batchtools job.id=1]" [10] "### [bt]: Calculation finished!" Unsetting registry as default Recursively removing files in 'D:/temp/2025_06_06_04_35_16_24916/RtmpEjnLum/.future/20250606_043653-EjnLum/batchtools_159184213' ... *** batchtools future error w/ future.delete = FALSE ... DONE *** batchtools future error w/ future.delete = TRUE ... [04:36:56.491] Launched future #1 Garbage collecting future ... BatchtoolsLocalFuture: Label: Expression: { x <- 1 print(x) stop("Woops!") } Globals: Packages: L'Ecuyer-CMRG RNG seed: (seed = FALSE) Capture standard output: TRUE Capture condition classes: 'condition' (excluding '') Immediate condition classes: 'immediateCondition' Lazy evaluation: FALSE Local evaluation: TRUE Asynchronous evaluation: TRUE Early signaling: FALSE Environment: R_GlobalEnv State: 'running' Resolved: TRUE Unique identifier: f04c69e06f520cbd8cbb20754d57c57e-4 Owner process: f04c69e06f520cbd8cbb20754d57c57e Class: 'BatchtoolsLocalFuture', 'BatchtoolsUniprocessFuture', 'BatchtoolsFuture', 'Future', 'environment' Value: Conditions captured: batchtools configuration file: 'D:/RCompile/CRANincoming/R-devel/lib/future.batchtools/templates-for-R_CMD_check/batchtools.conf.R' (82 bytes; 1 lines) batchtools cluster functions: 'Interactive' batchtools cluster functions template: batchtools status: 'defined', 'finished', 'started', 'submitted' batchtools Registry: File dir exists: TRUE Work dir exists: TRUE Job Registry Backend : Interactive File dir : D:/temp/2025_06_06_04_35_16_24916/RtmpEjnLum/.future/20250606_043653-EjnLum/batchtools_1940693397 Work dir : D:/RCompile/CRANincoming/R-devel/future.batchtools.Rcheck/tests Jobs : 1 Seed : 19806 Writeable: TRUE Garbage collecting future ... DONE - Future removed and garbage collected. - batchtools Registry path ('D:/temp/2025_06_06_04_35_16_24916/RtmpEjnLum/.future/20250606_043653-EjnLum/batchtools_1940693397') exists: FALSE *** batchtools future error w/ future.delete = TRUE ... DONE > > > message("*** BatchtoolsFuture - expired ...") *** BatchtoolsFuture - expired ... > plan(batchtools_local) > msg <- "Abruptly terminating the future!" > f <- future({ + cat(file = stderr(), msg) + quit(save = "no") + }) [04:36:57.980] Launched future #1 > res <- tryCatch({ + v <- value(f) + }, error = identity) Warning in readLines(log.file) : incomplete final line found on 'D:/temp/2025_06_06_04_35_16_24916/RtmpEjnLum/.future/20250606_043653-EjnLum/batchtools_958948570/logs/jobc06a5cf04594dcf5ebcb63bf7fdc741a.log' > stopifnot(inherits(res, "error"), + inherits(res, "FutureError")) > err_msg <- unlist(strsplit(conditionMessage(res), split = "\n", fixed = TRUE)) > stopifnot(any(grepl(msg, err_msg, fixed = TRUE))) > > message("*** BatchtoolsFuture - expired ... done") *** BatchtoolsFuture - expired ... done > > > if (fullTest) { + message("*** BatchtoolsFuture - deleting running ...") + + plan(batchtools_multicore) + + f <- future({ + Sys.sleep(2) + 42L + }) + + if (!resolved(f)) { + res <- delete(f, onRunning = "skip") + stopifnot(isTRUE(res)) + } + + if (!resolved(f)) { + res <- tryCatch({ + delete(f, onRunning = "warning") + }, warning = function(w) w) + stopifnot(inherits(res, "warning")) + } + + if (!resolved(f)) { + res <- tryCatch({ + delete(f, onRunning = "error") + }, error = function(ex) ex) + stopifnot(inherits(res, "error")) + } + + message("*** BatchtoolsFuture - deleting running ... DONE") + } ## if (fullTest) > > > message("*** BatchtoolsFutureError() ... DONE") *** BatchtoolsFutureError() ... DONE > > source("incl/end.R") > > proc.time() user system elapsed 1.87 0.35 7.21 Error : BatchtoolsExpiration: Future ('') expired (registry path D:/temp/2025_06_06_04_35_16_24916/RtmpEjnLum/.future/20250606_043653-EjnLum/batchtools_958948570).. The last few lines of the logged output: ### [bt]: This is batchtools v0.9.17 ### [bt]: Starting calculation of 1 jobs ### [bt]: Setting working directory to 'D:/RCompile/CRANincoming/R-devel/future.batchtools.Rcheck/tests' Loading required package: methods ### [bt]: Memory measurement disabled ### [bt]: Starting job [batchtools job.id=1] ### [bt]: Setting seed to 12320 ... Abruptly terminating the future! In addition: Warning message: In readLines(log.file) : incomplete final line found on 'D:/temp/2025_06_06_04_35_16_24916/RtmpEjnLum/.future/20250606_043653-EjnLum/batchtools_958948570/logs/jobc06a5cf04594dcf5ebcb63bf7fdc741a.log'