R Under development (unstable) (2024-03-25 r86192 ucrt) -- "Unsuffered Consequences" Copyright (C) 2024 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") [17:27:08.572] plan(): Setting new future strategy stack: [17:27:08.574] List of future strategies: [17:27:08.574] 1. sequential: [17:27:08.574] - args: function (..., envir = parent.frame(), workers = "") [17:27:08.574] - tweaked: FALSE [17:27:08.574] - call: future::plan("sequential") [17:27:08.589] plan(): nbrOfWorkers() = 1 > options(future.debug = FALSE) > > f_try <- function(f, ...) { + res <- tryCatch(..., error = identity) + if (inherits(res, "error")) { + label <- sQuote(f$label) + if (length(label) == 0) label <- "" + msg <- sprintf("Test with future (%s) of class %s failed assertion: %s", label, sQuote(class(f)[1]), conditionMessage(res)) + stop(msg, call.=FALSE) + } + res + } > > message("*** immediateCondition:s ...") *** immediateCondition:s ... > > immediateMessage <- function(..., domain = NULL, appendLF = TRUE) { + msg <- .makeMessage(..., domain = domain, appendLF = appendLF) + call <- sys.call() + m <- simpleMessage(msg, call) + class(m) <- c(class(m), "immediateCondition") + message(m) + invisible(m) + } > > immediateWarning <- function(..., domain = NULL) { + msg <- .makeMessage(..., domain = domain) + call <- sys.call() + w <- simpleWarning(msg, call) + class(w) <- c(class(w), "immediateCondition") + warning(w) + invisible(w) + } > > recordConditions <- function(expr, ...) { + conditions <- list() + withCallingHandlers(expr, condition = function(c) { + attr(c, "received") <- Sys.time() + conditions[[length(conditions) + 1L]] <<- c + }) + conditions + } > > recordMessages <- function(expr, ...) { + sapply(recordConditions(expr, ...), FUN = conditionMessage) + } > > ## FIXME: Make sure to set also with cores = 2L /HB 2020-11-10 > > if (isTRUE(getOption("future.psock.relay.immediate"))) { + excl <- "cluster" + if (getRversion() < "3.4.0") excl <- c(excl, "multisession") + strategies <- supportedStrategies(cores = 2L, excl = excl) + strategies <- c(strategies, "sequential") + } else { + strategies <- "sequential" + } > print(strategies) [1] "sequential" > > for (ss in seq_along(strategies)) { + strategy <- strategies[[ss]] + message(sprintf("Immediate relay w/ %s ...", names(strategies)[ss])) + plan(strategy) + + message("* A single future ...") + + message("- creating future") + msgs <- recordMessages({ + f <- future({ + immediateMessage("IM1") + message("M") + immediateWarning("IW") + immediateMessage("IM2") + ## RACE CONDITION IN ASSERTION: + ## Add some leeway for the immediateCondition files written by + ## multicore futures to "settle" on the file system + Sys.sleep(1.0) + 42L + }, label = "single-future") + }) + message(" class: ", paste(sQuote(class(f)), collapse = ", ")) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + if (inherits(f, "UniprocessFuture")) { + stopifnot(identical(msgs, c("IM1\n", "IW", "IM2\n"))) + } else { + stopifnot(length(msgs) == 0L) + } + }) + + message("- checking if resolved") + msgs <- recordMessages({ + r <- resolved(f) + }) + message(" result: ", r) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + if (inherits(f, "MultiprocessFuture")) { + stopifnot(identical(msgs, c("IM1\n", "IW", "IM2\n"))) + } else { + stopifnot(length(msgs) == 0L) + } + }) + + message("- resolve w/out collecting results") + msgs <- recordMessages({ + f <- resolve(f) + }) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + stopifnot(length(msgs) == 0L) + }) + + message("- resolve w/ collect results") + msgs <- recordMessages({ + f <- resolve(f, result = TRUE) + }) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + if (inherits(f, c("UniprocessFuture", "MultiprocessFuture"))) { + stopifnot(length(msgs) == 0L) + } else { + stopifnot(identical(msgs, c("IM1\n", "IW", "IM2\n"))) + } + }) + + message("- getting value") + msgs <- recordMessages({ + v <- value(f) + }) + message(" value: ", v) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + if (inherits(f, c("UniprocessFuture", "MultiprocessFuture"))) { + stopifnot(identical(msgs, "M\n")) + } else { + stopifnot(identical(msgs, c("IM1\n", "IW", "IM2\n", "M\n"))) + } + }) + + message("- getting value again") + msgs <- recordMessages({ + v <- value(f) + }) + message(" value: ", v) + f_try(f, { + stopifnot(identical(msgs, "M\n")) + }) + + message("* A single future ... DONE") + + + message("* Two futures ... ") + + message("- list of two futures") + fs <- list() + msgs <- recordMessages({ + fs[[1]] <- future({ + immediateMessage("IM1") + Sys.sleep(0.1) + message("M1") + immediateWarning("IW1") + ## RACE CONDITION IN ASSERTION: + ## Add some leeway for the immediateCondition files written by + ## multicore futures to "settle" on the file system + Sys.sleep(1.0) + 1L + }, label = "future-1") + fs[[2]] <- future({ + immediateMessage("IM2") + Sys.sleep(0.1) + message("M2") + immediateWarning("IW2") + ## RACE CONDITION IN ASSERTION: + ## Add some leeway for the immediateCondition files written by + ## multicore futures to "settle" on the file system + Sys.sleep(1.0) + 2L + }, label = "future-2") + }) + message(" class: ", paste(sQuote(class(fs[[1]])), collapse = ", ")) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(fs[[1]], { + if (inherits(fs[[1]], "UniprocessFuture")) { + stopifnot(identical(msgs, c("IM1\n", "IW1", "IM2\n", "IW2"))) + } else { + stopifnot(length(msgs) == 0L) + } + }) + + message("- check if resolved") + msgs <- recordMessages({ + rs <- resolved(fs) + }) + message(" result: ", paste(rs, collapse = ", ")) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + if (inherits(f, "MultiprocessFuture")) { + stopifnot(all(msgs %in% c("IM1\n", "IM2\n", "IW1", "IW2"))) + if (inherits(f, "MulticoreFuture")) { + stopifnot(identical(msgs, c("IM1\n", "IM2\n", "IW1", "IW2"))) + } else if (inherits(f, "MultisessionFuture")) { + stopifnot(identical(msgs, c("IM1\n", "IW1", "IM2\n", "IW2"))) + } + } else { + stopifnot(length(msgs) == 0L) + } + }) + + message("- resolve w/out collecting results") + msgs <- recordMessages({ + fs <- resolve(fs) + }) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + stopifnot(length(msgs) == 0L) + }) + + message("- resolve w/ collect results") + msgs <- recordMessages({ + fs <- resolve(fs, result = TRUE) + }) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + if (inherits(fs[[1]], c("UniprocessFuture", "MultiprocessFuture", "CallrFuture", "BatchtoolsFuture"))) { + stopifnot(length(msgs) == 0L) + } else { + stopifnot(identical(msgs, c("IM1\n", "IW1", "IM2\n", "IW2"))) + } + }) + + message("- getting value") + msgs <- recordMessages({ + vs <- value(fs) + }) + message(" values: ", paste(vs, collapse = ", ")) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + stopifnot(identical(msgs, c("M1\n", "M2\n"))) + }) + + message("- getting value again") + msgs <- recordMessages({ + vs <- value(fs) + }) + message(" values: ", paste(vs, collapse = ", ")) + message(sprintf(" msgs [n=%d]: %s", length(msgs), paste(sQuote(msgs), collapse = ", "))) + f_try(f, { + stopifnot(identical(msgs, c("M1\n", "M2\n"))) + }) + + message("- getting values one by one") + msgs <- recordMessages({ + vs <- c( + value(fs[[1]]), + value(fs[[2]]) + ) + }) + message(" values: ", paste(vs, collapse = ", ")) + f_try(f, { + stopifnot(identical(msgs, c("M1\n", "M2\n"))) + }) + + message("* Two futures ... DONE") + + message(sprintf("Immediate relay w/ %s ... done", names(strategies)[ss])) + } ## for (ss ...) * A single future ... - creating future IM1 Warning in immediateWarning("IW") : IW IM2 class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' msgs [n=3]: 'IM1 ', 'IW', 'IM2 ' - checking if resolved result: TRUE msgs [n=0]: - resolve w/out collecting results msgs [n=0]: - resolve w/ collect results msgs [n=0]: - getting value M value: 42 msgs [n=1]: 'M ' - getting value again M value: 42 * A single future ... DONE * Two futures ... - list of two futures IM1 Warning in immediateWarning("IW1") : IW1 IM2 Warning in immediateWarning("IW2") : IW2 class: 'SequentialFuture', 'UniprocessFuture', 'Future', 'environment' msgs [n=4]: 'IM1 ', 'IW1', 'IM2 ', 'IW2' - check if resolved result: TRUE, TRUE msgs [n=0]: - resolve w/out collecting results msgs [n=0]: - resolve w/ collect results msgs [n=0]: - getting value M1 M2 values: 1, 2 msgs [n=2]: 'M1 ', 'M2 ' - getting value again M1 M2 values: 1, 2 msgs [n=2]: 'M1 ', 'M2 ' - getting values one by one M1 M2 values: 1, 2 * Two futures ... DONE > > message("*** immediateCondition:s ... DONE") *** immediateCondition:s ... DONE > > source("incl/end.R") Failed to undo environment variables: - Expected environment variables: [n=204] '!ExitCode', 'ALLUSERSPROFILE', 'APPDATA', 'BIBINPUTS', 'BINDIR', 'BSTINPUTS', 'COMMONPROGRAMFILES', 'COMPUTERNAME', 'COMSPEC', 'CURL_CA_BUNDLE', 'CYGWIN', 'CommonProgramFiles(x86)', 'CommonProgramW6432', 'DriverData', 'HOME', 'HOMEDRIVE', 'HOMEPATH', 'JAGS_ROOT', 'JAVA_HOME', 'LANGUAGE', 'LC_COLLATE', 'LC_MONETARY', 'LC_TIME', 'LOCALAPPDATA', 'LOGONSERVER', 'LS_HOME', 'LS_LICENSE_PATH', 'MAKE', 'MAKEFLAGS', 'MAKELEVEL', 'MFLAGS', 'MSMPI_BENCHMARKS', 'MSMPI_BIN', 'MSYS2_ENV_CONV_EXCL', 'NUMBER_OF_PROCESSORS', 'OCL', 'OMP_THREAD_LIMIT', 'OS', 'PATH', 'PATHEXT', 'PROCESSOR_ARCHITECTURE', 'PROCESSOR_IDENTIFIER', 'PROCESSOR_LEVEL', 'PROCESSOR_REVISION', 'PROGRAMFILES', 'PROMPT', 'PSModulePath', 'PUBLIC', 'PWD', 'ProgramData', 'ProgramFiles(x86)', 'ProgramW6432', 'RTOOLS43_HOME', 'RTOOLS44_HOME', 'R_ARCH', 'R_BROWSER', 'R_BZIPCMD', 'R_CMD', 'R_COMPILED_BY', 'R_CRAN_WEB', 'R_CUSTOM_TOOLS_PATH', 'R_CUSTOM_TOOLS_SOFT', 'R_DOC_DIR', 'R_ENVIRON_USER', 'R_GSCMD', 'R_GZIPCMD', 'R_HOME', 'R_INCLUDE_DIR', 'R_INSTALL_TAR', 'R_LIBS', 'R_LIBS_SITE', 'R_LIBS_USER', 'R_MAX_NUM_DLLS', 'R_OSTYPE', 'R_PAPERSIZE', 'R_PAPERSIZE_USER', 'R_PARALLELLY_MAKENODEPSOCK_AUTOKILL', 'R_PARALLELLY_MAKENODEPSOCK_CONNECTTIMEOUT', 'R_PARALLELLY_MAKENODEPSOCK_RSCRIPT_LABEL', 'R_PARALLELLY_MAKENODEPSOCK_SESSIONINFO_PKGS', 'R_PARALLELLY_MAKENODEPSOCK_TIMEOUT', 'R_PARALLELLY_RANDOM_PORTS', 'R_PARALLEL_PORT', 'R_RD4PDF', 'R_RTOOLS44_PATH', 'R_SCRIPT_LEGACY', 'R_SHARE_DIR', 'R_TESTS', 'R_UNZIPCMD', 'R_USER', 'R_VERSION', 'R_ZIPCMD', 'SED', 'SHLVL', 'SYSTEMDRIVE', 'SYSTEMROOT', 'TAR', 'TAR_OPTIONS', 'TEMP', 'TERM', 'TEXINPUTS', 'TMP', 'TMPDIR', 'USERDOMAIN', 'USERDOMAIN_ROAMINGPROFILE', 'USERNAME', 'USERPROFILE', 'WINDIR', '_', '_R_CHECK_AUTOCONF_', '_R_CHECK_BOGUS_RETURN_', '_R_CHECK_BROWSER_NONINTERACTIVE_', '_R_CHECK_BUILD_VIGNETTES_SEPARATELY_', '_R_CHECK_CODETOOLS_PROFILE_', '_R_CHECK_CODE_ASSIGN_TO_GLOBALENV_', '_R_CHECK_CODE_ATTACH_', '_R_CHECK_CODE_CLASS_IS_STRING_', '_R_CHECK_CODE_DATA_INTO_GLOBALENV_', '_R_CHECK_CODE_USAGE_VIA_NAMESPACES_', '_R_CHECK_CODE_USAGE_WITHOUT_LOADING_', '_R_CHECK_CODE_USAGE_WITH_ONLY_BASE_ATTACHED_', '_R_CHECK_CODOC_VARIABLES_IN_USAGES_', '_R_CHECK_COMPACT_DATA2_', '_R_CHECK_COMPILATION_FLAGS_', '_R_CHECK_CONNECTIONS_LEFT_OPEN_', '_R_CHECK_CRAN_INCOMING_', '_R_CHECK_CRAN_INCOMING_CHECK_FILE_URIS_', '_R_CHECK_CRAN_INCOMING_CHECK_URLS_IN_PARALLEL_', '_R_CHECK_CRAN_INCOMING_NOTE_GNU_MAKE_', '_R_CHECK_CRAN_INCOMING_REMOTE_', '_R_CHECK_CRAN_INCOMING_USE_ASPELL_', '_R_CHECK_DATALIST_', '_R_CHECK_DEPRECATED_DEFUNCT_', '_R_CHECK_DOC_SIZES2_', '_R_CHECK_DOT_FIRSTLIB_', '_R_CHECK_DOT_INTERNAL_', '_R_CHECK_EXAMPLE_TIMING_THRESHOLD_', '_R_CHECK_EXECUTABLES_', '_R_CHECK_EXECUTABLES_EXCLUSIONS_', '_R_CHECK_FF_CALLS_', '_R_CHECK_FF_DUP_', '_R_CHECK_FORCE_SUGGESTS_', '_R_CHECK_FUTURE_FILE_TIMESTAMPS_', '_R_CHECK_FUTURE_FILE_TIMESTAMPS_LEEWAY_', '_R_CHECK_HAVE_MYSQL_', '_R_CHECK_HAVE_ODBC_', '_R_CHECK_HAVE_PERL_', '_R_CHECK_HAVE_POSTGRES_', '_R_CHECK_INSTALL_DEPENDS_', '_R_CHECK_INTERNALS2_', '_R_CHECK_LENGTH_1_CONDITION_', '_R_CHECK_LICENSE_', '_R_CHECK_LIMIT_CORES_', '_R_CHECK_MATRIX_DATA_', '_R_CHECK_MBCS_CONVERSION_FAILURE_', '_R_CHECK_NATIVE_ROUTINE_REGISTRATION_', '_R_CHECK_NEWS_IN_PLAIN_TEXT_', '_R_CHECK_NO_RECOMMENDED_', '_R_CHECK_NO_STOP_ON_TEST_ERROR_', '_R_CHECK_ORPHANED_', '_R_CHECK_OVERWRITE_REGISTERED_S3_METHODS_', '_R_CHECK_PACKAGES_USED_IGNORE_UNUSED_IMPORTS_', '_R_CHECK_PACKAGES_USED_IN_TESTS_USE_SUBDIRS_', '_R_CHECK_PACKAGE_DATASETS_SUPPRESS_NOTES_', '_R_CHECK_PACKAGE_NAME_', '_R_CHECK_PKG_SIZES_', '_R_CHECK_PKG_SIZES_THRESHOLD_', '_R_CHECK_PRAGMAS_', '_R_CHECK_RD_EXAMPLES_T_AND_F_', '_R_CHECK_RD_LINE_WIDTHS_', '_R_CHECK_RD_MATH_RENDERING_', '_R_CHECK_RD_NOTE_LOST_BRACES_', '_R_CHECK_RD_VALIDATE_RD2HTML_', '_R_CHECK_REPLACING_IMPORTS_', '_R_CHECK_R_DEPENDS_', '_R_CHECK_S3_METHODS_SHOW_POSSIBLE_ISSUES_', '_R_CHECK_SCREEN_DEVICE_', '_R_CHECK_SERIALIZATION_', '_R_CHECK_SHLIB_OPENMP_FLAGS_', '_R_CHECK_SRC_MINUS_W_IMPLICIT_', '_R_CHECK_SUBDIRS_NOCASE_', '_R_CHECK_SUGGESTS_ONLY_', '_R_CHECK_SYSTEM_CLOCK_', '_R_CHECK_TESTS_NLINES_', '_R_CHECK_TEST_TIMING_', '_R_CHECK_TIMINGS_', '_R_CHECK_TOPLEVEL_FILES_', '_R_CHECK_UNDOC_USE_ALL_NAMES_', '_R_CHECK_UNSAFE_CALLS_', '_R_CHECK_URLS_SHOW_301_STATUS_', '_R_CHECK_VC_DIRS_', '_R_CHECK_VIGNETTES_NLINES_', '_R_CHECK_VIGNETTES_SKIP_RUN_MAYBE_', '_R_CHECK_VIGNETTE_TIMING_', '_R_CHECK_VIGNETTE_TITLES_', '_R_CHECK_WINDOWS_DEVICE_', '_R_CHECK_XREFS_USE_ALIASES_FROM_CRAN_', '_R_CLASS_MATRIX_ARRAY_', '_R_DEPRECATED_IS_R_', '_R_S3_METHOD_LOOKUP_BASEENV_AFTER_GLOBALENV_', '_R_SHLIB_BUILD_OBJECTS_SYMBOL_TABLES_', '__R_CHECK_DOC_FILES_NOTE_IF_ALL_SPECIAL__', 'maj.version', 'nextArg--timingsnextArg--install' - Environment variables still there: [n=0] - Environment variables missing: [n=1] 'MAKEFLAGS' Differences environment variable by environment variable: List of 3 $ name : chr "MAKEFLAGS" $ expected: 'Dlist' chr "" $ actual : 'Dlist' chr NA > > proc.time() user system elapsed 0.46 0.06 3.82