Checks the status of bbi_base_model object(s) by looking for a
bbi_config.json file. Other operations (such as returning messages or
freezing the R console) may be done as a result.
Usage
check_nonmem_finished(.mod, ...)
get_model_status(.mod, max_print = 10, ...)
wait_for_nonmem(.mod, .time_limit = 300, .interval = 5, .delay = 1.5)Arguments
- .mod
a
bbi_base_modelor list ofbbi_base_modelobjects. Other packages (e.g.,bbr.bayes) may add additional methods.- ...
Arguments passed to methods.
- max_print
max number of models to explicitly print to the console. If the number of finished or incomplete models are greater than this number, just print the number of models.
- .time_limit
integer for maximum number of seconds in total to wait before continuing (will exit after this time even if the run does not appear to have finished).
- .interval
integer for number of seconds to wait between each check.
- .delay
integer for number of seconds to wait before scanning the output directories. This function will exit early if no output directory exists, so this argument serves to delay this evaluation (e.g. if calling right after
submit_model()in anRmarkdownfile).
Details
If the result of get_model_status() assigned to a variable, users can
inspect the full list of runs to determine exactly which models are still
running vs. have finished executing:
Functions
check_nonmem_finished(): ReturnsTRUEif the model appears to be finished running andFALSEotherwise.get_model_status(): Returns messages indicating which model(s) have finished executing and which are incomplete. Also invisibly returns adata.framewith a row for each model and a logicalfinishedcolumn.wait_for_nonmem(): Wait forNONMEMmodels to finish. i.e. freeze the user's console until the model(s) have finished running.
Examples
if (FALSE) { # \dontrun{
# Check if model(s) or bootstrap run has finished:
check_nonmem_finished(.mod)
#> [1] TRUE
check_nonmem_finished(.boot_run)
#> [1] FALSE
# Inspect progress of model(s) or bootstrap run:
get_model_status(.mod)
#> The following model(s) have finished: `1`
#> 0 model(s) are incomplete
get_model_status(.boot_run)
#> 25 model(s) have finished
#> 75 model(s) are incomplete
get_model_status(list(.mod, .boot_run))
#> The following model(s) have finished: `1`
#> The following model(s) are incomplete: `1-boot`
# Freeze the `R` console until model(s) or bootstrap run has finished:
wait_for_nonmem(.mod)
#> Waiting for 1 model(s) to finish...
#> 1 model(s) have finished
# Batch submissions take longer to start
wait_for_nonmem(.boot_run, .delay = 6)
#> Waiting for 100 model(s) to finish...
#> Waiting for 50 model(s) to finish...
#> 100 model(s) have finished
} # }
