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.
check_nonmem_finished(.mod, ...)
get_model_status(.mod, max_print = 10, ...)
wait_for_nonmem(.mod, .time_limit = 300, .interval = 5, .delay = 1.5)
a bbi_base_model
or list of bbi_base_model
objects. Other
packages (e.g., bbr.bayes
) may add additional methods.
Arguments passed to methods.
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.
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).
integer for number of seconds to wait between each check.
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 an Rmarkdown
file).
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:
check_nonmem_finished()
: Returns TRUE
if the model appears to be finished
running and FALSE
otherwise.
get_model_status()
: Returns messages indicating which model(s) have
finished executing and which are incomplete. Also invisibly returns a
data.frame
with a row for each model and a logical finished
column.
wait_for_nonmem()
: Wait for NONMEM
models to finish. i.e. freeze the
user's console until the model(s) have finished running.
if (FALSE) {
# 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
}