From 3ba5dd37857bda05e9bc25f7a74e144216e59c97 Mon Sep 17 00:00:00 2001 From: Nick-Eagles Date: Tue, 28 Nov 2023 16:08:21 -0500 Subject: [PATCH] Add documentation for a missing parameter; fix reference to 'parse_file_or_name' in example --- R/job_loop.R | 5 ++--- R/job_single.R | 9 ++++----- R/utils.R | 3 ++- man/parse_file_or_name.Rd | 4 +++- 4 files changed, 11 insertions(+), 10 deletions(-) diff --git a/R/job_loop.R b/R/job_loop.R index f3b8e28..c125ca9 100644 --- a/R/job_loop.R +++ b/R/job_loop.R @@ -25,9 +25,8 @@ #' cores = 2 #' ) #' -job_loop <- function( - loops, name, create_shell = FALSE, partition = "shared", memory = "10G", - cores = 1L, tc = 20, email = "ALL", logdir = "logs") { +job_loop <- function(loops, name, create_shell = FALSE, partition = "shared", memory = "10G", + cores = 1L, tc = 20, email = "ALL", logdir = "logs") { ## Check that the loops are correctly defined if (!is.list(loops)) { stop("'loops' should be a named list.", call. = FALSE) diff --git a/R/job_single.R b/R/job_single.R index f7406cb..5974ee0 100644 --- a/R/job_single.R +++ b/R/job_single.R @@ -56,11 +56,10 @@ #' ## An array job #' job_single("jhpce_job_array", task_num = 20, create_logdir = FALSE) #' -job_single <- function( - name, create_shell = FALSE, partition = "shared", memory = "10G", - cores = 1L, email = "ALL", logdir = "logs", task_num = NULL, tc = 20, - command = 'Rscript -e "options(width = 120); sessioninfo::session_info()"', - create_logdir = TRUE) { +job_single <- function(name, create_shell = FALSE, partition = "shared", memory = "10G", + cores = 1L, email = "ALL", logdir = "logs", task_num = NULL, tc = 20, + command = 'Rscript -e "options(width = 120); sessioninfo::session_info()"', + create_logdir = TRUE) { # Grab the path to the shell script, and the shell script's name, # respectively sh_file <- parse_file_or_name(name, should_exist = FALSE, r_ok = FALSE) diff --git a/R/utils.R b/R/utils.R index 3d0f131..a754607 100644 --- a/R/utils.R +++ b/R/utils.R @@ -167,6 +167,7 @@ parse_slurm_time <- function(tim) { #' (relative or absolute) to the shell or R script to create #' @param should_exist A \code{logical(1)} vector. If TRUE, the specified script #' must already exist; if FALSE, it must not exist +#' @param r_ok A \code{logical(1)} vector. If TRUE, \code{name} may end in '.R' #' #' @return A \code{character(1)} giving the absolute or relative path to the #' shell script @@ -185,7 +186,7 @@ parse_slurm_time <- function(tim) { #' "my_script" #' ) #' returned_scripts <- sapply( -#' acceptable_names, parse_file_or_name, +#' acceptable_names, slurmjobs:::parse_file_or_name, #' should_exist = FALSE #' ) #' print(returned_scripts) diff --git a/man/parse_file_or_name.Rd b/man/parse_file_or_name.Rd index 1690be7..69dd365 100644 --- a/man/parse_file_or_name.Rd +++ b/man/parse_file_or_name.Rd @@ -12,6 +12,8 @@ parse_file_or_name(name, should_exist, r_ok) \item{should_exist}{A \code{logical(1)} vector. If TRUE, the specified script must already exist; if FALSE, it must not exist} + +\item{r_ok}{A \code{logical(1)} vector. If TRUE, \code{name} may end in '.R'} } \value{ A \code{character(1)} giving the absolute or relative path to the @@ -34,7 +36,7 @@ acceptable_names <- c( "my_script" ) returned_scripts <- sapply( - acceptable_names, parse_file_or_name, + acceptable_names, slurmjobs:::parse_file_or_name, should_exist = FALSE ) print(returned_scripts)