metrumresearchgroup / bbr

R interface for model and project management
https://metrumresearchgroup.github.io/bbr/
Other
23 stars 2 forks source link

Patch For Threads #554

Closed rymarinelli closed 1 year ago

rymarinelli commented 1 year ago

Closes #553

rymarinelli commented 1 year ago

@seth127 I tried to add additional logic to address if threads is NULL. If threads is null, the handling present in check_bbi_args will raise with a type error. Since NULL is not a numeric, it will error here.

    # check type
    if (ref$type == "character") {
      type_pass_bool <- is_bare_character(.v)
    } else if (ref$type == "logical") {
      type_pass_bool <- is_bare_logical(.v)
    } else if (ref$type == "numeric") {
      type_pass_bool <- is_bare_numeric(.v)
    } else {
      # This feels weird to put an intentional bug catch in here, but I don't like having to rely on raw string matching
      # from our aaa.R file to trigger functionality, so this feels like the safest option.
      stop(paste0("BUG!!! BBI_ARGS[['", .n, "']][['type']] is `", ref$type, "` which is invalid. 
     Must be either 'character', 'logical', or 'numeric'"))
seth127 commented 1 year ago

Just noting on here that this comment above led to creating https://github.com/metrumresearchgroup/bbr/issues/555. I'm not sure if that needs to be addressed before this PR or not, but it might.

kyleam commented 1 year ago

Hmm, that's a nasty error for the mpn oldest/R4.0 check build:

 *** caught segfault ***
address 0x55be988d32d0, cause 'invalid permissions'

The push build passed, so I'm not confident we're going to be able to retrigger and investigate that.

I'd suggest restarting the build (via the drone interface) to see whether it persists.

full log ``` + R -s -e 'devtools::install_deps(upgrade = '"'"'never'"'"')' Installing 1 packages: diffobj Installing package into ‘/opt/rpkgs’ (as ‘lib’ is unspecified) trying URL 'https://packagemanager.rstudio.com/all/__linux__/bionic/292/src/contrib/diffobj_0.3.0.tar.gz' Content type 'binary/octet-stream' length 1000382 bytes (976 KB) ================================================== downloaded 976 KB * installing *binary* package ‘diffobj’ ... * DONE (diffobj) The downloaded source packages are in ‘/tmp/Rtmp4GMrEC/downloaded_packages’ + R -s -e 'devtools::check(env_vars = c("BBI_EXE_PATH" = "/ephemeral/bbi", "NOT_CRAN" = "true"))' Updating bbr documentation Warning: Version of roxygen2 last used with this package is 7.2.1. You only have version 7.1.0 Loading bbr Writing NAMESPACE Writing NAMESPACE Writing create_bbi_object.Rd Writing copy_model_from.Rd Writing cov_cor.Rd Writing get_based_on.Rd Writing get_model_id.Rd Writing get_data_path.Rd Writing model_summaries.Rd Writing as_summary_list.Rd Writing model_summary.Rd Writing modify_model_field.Rd Writing modify_tags.Rd Writing modify_notes.Rd Writing modify_based_on.Rd Writing modify_star.Rd Writing modify_description.Rd Writing modify_bbi_args.Rd Writing verify_model_yaml_integrity.Rd Writing nm_file.Rd Writing nm_tables.Rd Writing param_estimates_compare.Rd Writing param_estimates.Rd Writing param_labels.Rd Writing print_bbi.Rd Writing check_file.Rd Writing check_output_dir.Rd Writing check_nonmem_table_output.Rd Writing plot_nonmem_table_df.Rd Writing submit_model.Rd Writing submit_models.Rd Writing extract_from_summary.Rd Writing wait_for_nonmem.Rd ── Building ───────────────────────────────────────────────────────────── bbr ── Setting env vars: ● CFLAGS : -Wall -pedantic ● CXXFLAGS : -Wall -pedantic ● CXX11FLAGS: -Wall -pedantic ──────────────────────────────────────────────────────────────────────────────── checking for file ‘/drone/src/DESCRIPTION’ ... ✔ checking for file ‘/drone/src/DESCRIPTION’ ─ preparing ‘bbr’: checking DESCRIPTION meta-information ... ✔ checking DESCRIPTION meta-information ─ installing the package to build vignettes creating vignettes ... ✔ creating vignettes (19.4s) ─ checking for LF line-endings in source and make files and shell scripts ─ checking for empty or unneeded directories Removed empty directory ‘bbr/bbi_linux_amd64’ ─ building ‘bbr_1.4.0.tar.gz’ ── Checking ───────────────────────────────────────────────────────────── bbr ── Setting env vars: ● _R_CHECK_CRAN_INCOMING_REMOTE_: FALSE ● _R_CHECK_CRAN_INCOMING_ : FALSE ● _R_CHECK_FORCE_SUGGESTS_ : FALSE ● BBI_EXE_PATH : /ephemeral/bbi ● NOT_CRAN : true ── R CMD check ───────────────────────────────────────────────────────────────── * using log directory ‘/tmp/RtmpHuBw0K/bbr.Rcheck’ * using R version 4.0.3 (2020-10-10) * using platform: x86_64-pc-linux-gnu (64-bit) * using session charset: UTF-8 * using options ‘--no-manual --as-cran’ * checking for file ‘bbr/DESCRIPTION’ ... OK * checking extension type ... Package * this is package ‘bbr’ version ‘1.4.0’ * package encoding: UTF-8 * checking package namespace information ... OK * checking package dependencies ... NOTE Packages suggested but not available for checking: 'mrgvalidate', 'mrgvalprep' Imports includes 21 non-default packages. Importing from so many packages makes the package vulnerable to any of them becoming unavailable. Move as many as possible to Suggests and use conditionally. * checking if this is a source package ... OK * checking if there is a namespace ... OK * checking for executable files ... OK * checking for hidden files and directories ... OK * checking for portable file names ... OK * checking for sufficient/correct file permissions ... OK * checking whether package ‘bbr’ can be installed ... OK * checking installed package size ... OK * checking package directory ... OK * checking for future file timestamps ... OK * checking ‘build’ directory ... OK * checking DESCRIPTION meta-information ... OK * checking top-level files ... OK * checking for left-over files ... OK * checking index information ... OK * checking package subdirectories ... OK * checking R files for non-ASCII characters ... OK * checking R files for syntax errors ... OK * checking whether the package can be loaded ... OK * checking whether the package can be loaded with stated dependencies ... OK * checking whether the package can be unloaded cleanly ... OK * checking whether the namespace can be loaded with stated dependencies ... OK * checking whether the namespace can be unloaded cleanly ... OK * checking loading without being on the library search path ... OK * checking dependencies in R code ... NOTE Missing or unexported object: ‘cli::ansi_strwrap’ * checking S3 generic/method consistency ... OK * checking replacement functions ... OK * checking foreign function calls ... OK * checking R code for possible problems ... OK * checking Rd files ... OK * checking Rd metadata ... OK * checking Rd line widths ... OK * checking Rd cross-references ... OK * checking for missing documentation entries ... OK * checking for code/documentation mismatches ... OK * checking Rd \usage sections ... OK * checking Rd contents ... OK * checking for unstated dependencies in examples ... OK * checking installed files from ‘inst/doc’ ... OK * checking files in ‘vignettes’ ... OK * checking examples ... OK * checking for unstated dependencies in ‘tests’ ... OK * checking tests ... Running ‘testthat.R’ [36s/38s] ERROR Running the tests in ‘tests/testthat.R’ failed. Last 13 lines of output: 32: withRestarts(testthat_abort_reporter = function() NULL, force(code)) 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, { reporter$start_file(basename(path)) lister$start_file(basename(path)) source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap) reporter$.end_context() reporter$end_file() }) 34: FUN(X[[i]], ...) 35: lapply(paths, test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap) 36: force(code) 37: doWithOneRestart(return(expr), restart) 38: withOneRestart(expr, restarts[[1L]]) 39: withRestarts(testthat_abort_reporter = function() NULL, force(code)) 40: with_reporter(reporter = current_reporter, results <- lapply(paths, test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)) 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap) 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap) 43: test_package_dir(package = package, test_path = test_path, filter = filter, reporter = reporter, ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap) 44: test_check("bbr") An irrecoverable exception occurred. R is aborting now ... Segmentation fault (core dumped) * checking for unstated dependencies in vignettes ... OK * checking package vignettes in ‘inst/doc’ ... OK * checking re-building of vignette outputs ... OK * checking for non-standard things in the check directory ... OK * checking for detritus in the temp directory ... OK * DONE Status: 1 ERROR, 2 NOTEs See ‘/tmp/RtmpHuBw0K/bbr.Rcheck/00check.log’ for details. ── R CMD check results ────────────────────────────────────────── bbr 1.4.0 ──── Duration: 1m 59.7s ❯ checking tests ... See below... ❯ checking package dependencies ... NOTE Packages suggested but not available for checking: 'mrgvalidate', 'mrgvalprep' Imports includes 21 non-default packages. Importing from so many packages makes the package vulnerable to any of them becoming unavailable. Move as many as possible to Suggests and use conditionally. ❯ checking dependencies in R code ... NOTE Missing or unexported object: ‘cli::ansi_strwrap’ ── Test failures ───────────────────────────────────────────────── testthat ──── > library(testthat) > library(bbr) > > test_check("bbr") *** caught segfault *** address 0x55be988d32d0, cause 'invalid permissions' Traceback: 1: dir_map(old, identity, all, recurse, type, fail) 2: dir_ls(.base_dir, recurse = .recurse) 3: find_models(.base_dir, .recurse, .include) 4: summary_log(MODEL_DIR, .bbi_args = list(no_grd_file = TRUE)) 5: eval(code, test_env) 6: eval(code, test_env) 7: withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error) 8: doTryCatch(return(expr), name, parentenv, handler) 9: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 10: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) 11: doTryCatch(return(expr), name, parentenv, handler) 12: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]]) 13: tryCatchList(expr, classes, parentenv, handlers) 14: tryCatch(withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error), error = handle_fatal, skip = function(e) { }) 15: test_code(desc, code, env = parent.frame()) 16: test_that("summary_log works some failed summaries [BBR-SMLG-008]", { clean_test_enviroment(create_all_models) copy_all_output_dirs() fs::file_delete(file.path(LEVEL2_MOD, "1.grd")) sum_df <- summary_log(MODEL_DIR) expect_equal(is.na(sum_df$error_msg), c(TRUE, TRUE, TRUE, FALSE)) expect_equal(ncol(sum_df), SUM_LOG_COLS) expect_equal(sum_df[[SL_FAIL_FLAGS]], c(FALSE, FALSE, FALSE, FALSE)) sum_df <- summary_log(MODEL_DIR, .bbi_args = list(no_grd_file = TRUE)) test_sum_df(sum_df, c(MOD1_PATH, NEW_MOD2, NEW_MOD3, LEVEL2_MOD), SUM_LOG_COLS) fs::file_delete(file.path(NEW_MOD2, "2.ext")) sum_df <- summary_log(MODEL_DIR, .bbi_args = list(no_grd_file = TRUE)) expect_equal(is.na(sum_df$error_msg), c(TRUE, FALSE, TRUE, TRUE)) expect_equal(ncol(sum_df), SUM_LOG_COLS) expect_equal(sum_df[[SL_FAIL_FLAGS]], c(FALSE, FALSE, FALSE, FALSE)) sum_df <- summary_log(MODEL_DIR, .fail_flags = list(no_grd_file = TRUE)) expect_equal(is.na(sum_df$error_msg), c(TRUE, FALSE, TRUE, TRUE)) expect_equal(ncol(sum_df), SUM_LOG_COLS) expect_equal(sum_df[[SL_FAIL_FLAGS]], c(FALSE, FALSE, FALSE, TRUE)) }) 17: eval(code, test_env) 18: eval(code, test_env) 19: withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error) 20: doTryCatch(return(expr), name, parentenv, handler) 21: tryCatchOne(expr, names, parentenv, handlers[[1L]]) 22: tryCatchList(expr, names[-nh], parentenv, handlers[-nh]) 23: doTryCatch(return(expr), name, parentenv, handler) 24: tryCatchOne(tryCatchList(expr, names[-nh], parentenv, handlers[-nh]), names[nh], parentenv, handlers[[nh]]) 25: tryCatchList(expr, classes, parentenv, handlers) 26: tryCatch(withCallingHandlers({ eval(code, test_env) if (!handled && !is.null(test)) { skip_empty() }}, expectation = handle_expectation, skip = handle_skip, warning = handle_warning, message = handle_message, error = handle_error), error = handle_fatal, skip = function(e) { }) 27: test_code(NULL, exprs, env) 28: source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap) 29: force(code) 30: doWithOneRestart(return(expr), restart) 31: withOneRestart(expr, restarts[[1L]]) 32: withRestarts(testthat_abort_reporter = function() NULL, force(code)) 33: with_reporter(reporter = reporter, start_end_reporter = start_end_reporter, { reporter$start_file(basename(path)) lister$start_file(basename(path)) source_file(path, new.env(parent = env), chdir = TRUE, wrap = wrap) reporter$.end_context() reporter$end_file() }) 34: FUN(X[[i]], ...) 35: lapply(paths, test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap) 36: force(code) 37: doWithOneRestart(return(expr), restart) 38: withOneRestart(expr, restarts[[1L]]) 39: withRestarts(testthat_abort_reporter = function() NULL, force(code)) 40: with_reporter(reporter = current_reporter, results <- lapply(paths, test_file, env = env, reporter = current_reporter, start_end_reporter = FALSE, load_helpers = FALSE, wrap = wrap)) 41: test_files(paths, reporter = reporter, env = env, stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap) 42: test_dir(path = test_path, reporter = reporter, env = env, filter = filter, ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap) 43: test_package_dir(package = package, test_path = test_path, filter = filter, reporter = reporter, ..., stop_on_failure = stop_on_failure, stop_on_warning = stop_on_warning, wrap = wrap) 44: test_check("bbr") An irrecoverable exception occurred. R is aborting now ... Segmentation fault (core dumped) 1 error ✖ | 0 warnings ✔ | 2 notes ✖ Error: R CMD check found ERRORs Execution halted ```