-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
updated config file generating function removed the call from submit-…
…model. Swapped around messages about setting slurmtools options.
- Loading branch information
Showing
8 changed files
with
105 additions
and
108 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,7 +21,6 @@ Imports: | |
utils, | ||
whisker, | ||
withr, | ||
configr, | ||
rextendr, | ||
here | ||
Suggests: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
#' Creates a default watcher configuration file | ||
#' | ||
#' @param .mod a bbi nonmem model object | ||
#' @param model_number a string of model number e.g. 101a15. Default is pulled from .mod | ||
#' @param files_to_track a vector of file extensions. Default is c("lst", "ext", "grd") | ||
#' @param tmp_dir a temporary directory location to run nonmem. Default is /tmp | ||
#' @param watched_dir the directory where nonmem will output. Default is ./model/nonmem | ||
#' @param output_dir the directory where watcher will place log and any output files default is ./model/nonmem/in_progress | ||
#' @param poll_duration the amount of time in seconds between the watchers polling | ||
#' @param alert Where to send alerts if any. Default is None, available options are None or Slack | ||
#' @param level What level to log at. Default is info. Available options are Trace, Debug, Info, Warn, Fatal | ||
#' @param email if alert is set to Slack, this should be the email associated with slack to get messages sent directly to you. | ||
#' @param threads number of threads if running a parallel job. Default is 1 | ||
#' | ||
#' @return none | ||
#' @keywords internal | ||
#' @export | ||
#' | ||
#' @examples \dontrun{ | ||
#' generate_watcher_config(.mod) | ||
#' } | ||
generate_watcher_config <- function( | ||
.mod, | ||
model_number = "", | ||
files_to_track = c("lst", "ext", "grd"), | ||
tmp_dir = "/tmp", | ||
watched_dir = file.path("model", "nonmem"), | ||
output_dir = file.path(watched_dir, "in_progress"), | ||
poll_duration = 1, | ||
alert = "None", | ||
level = "Debug", | ||
email = "", | ||
threads = 1 | ||
) { | ||
if (model_number == "") { | ||
model_number <- basename(.mod$absolute_model_path) | ||
} | ||
|
||
alert <- paste0(toupper(substring(alert, 1, 1)), substring(alert, 2)) | ||
level <- paste0(toupper(substring(level, 1, 1)), substring(level, 2)) | ||
|
||
if (alert == "Slack" && email == "") { | ||
rlang::abort("If you want slack notifications you must also supply an email.") | ||
} | ||
|
||
toml <- list( | ||
model_number = model_number, | ||
files_to_track = files_to_track, | ||
tmp_dir = tmp_dir, | ||
watched_dir = file.path(here::here(), watched_dir), | ||
output_dir = file.path(here::here(), output_dir), | ||
poll_duration = poll_duration, | ||
alert = alert, | ||
level = level, | ||
email = email, | ||
threads = threads | ||
) | ||
|
||
config_toml_path <- paste0(.mod$absolute_model_path, ".toml") | ||
write_file(rextendr::to_toml(toml), config_toml_path) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,11 +1,13 @@ | ||
.onLoad <- function(libname, pkgname) { | ||
.onAttach <- function(libname, pkgname) { | ||
if (is.null(getOption('slurmtools.slurm_job_template_path'))) { | ||
rlang::warn( | ||
"option('slurmtools.slurm_job_template_path') is not set. Please set it for job submission defaults to work." | ||
) | ||
# rlang::warn( | ||
# "option('slurmtools.slurm_job_template_path') is not set. Please set it for job submission defaults to work." | ||
# ) | ||
packageStartupMessage("option('slurmtools.slurm_job_template_path') is not set. Please set it for job submission defaults to work.") | ||
} | ||
|
||
if (is.null(getOption('slurmtools.submission_root'))) { | ||
rlang::warn("option('slurmtools.submission_root') is not set. Please set it for job submission defaults to work.") | ||
#rlang::warn("option('slurmtools.submission_root') is not set. Please set it for job submission defaults to work.") | ||
packageStartupMessage("option('slurmtools.submission_root') is not set. Please set it for job submission defaults to work.") | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.