From cee249e4a2b9d87594dcbe77949be5b7b8615dee Mon Sep 17 00:00:00 2001 From: Nick-Eagles Date: Mon, 23 Oct 2023 15:10:18 -0400 Subject: [PATCH] Style code --- R/array_submit.R | 10 +++++----- R/job_loop.R | 5 ++--- R/job_single.R | 9 +++++---- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/R/array_submit.R b/R/array_submit.R index 576e2de..303031e 100644 --- a/R/array_submit.R +++ b/R/array_submit.R @@ -50,7 +50,7 @@ #' array_submit <- function(name, task_ids = NULL, submit = FALSE, restore = TRUE, verbose = FALSE) { ## Check existence and validity of the shell script - if ((basename(name) != name) || !file.exists(paste0(name, '.sh'))) { + if ((basename(name) != name) || !file.exists(paste0(name, ".sh"))) { stop( paste( "'name' must give the name of a shell script in the current", @@ -59,7 +59,7 @@ array_submit <- function(name, task_ids = NULL, submit = FALSE, restore = TRUE, ) } - job_original <- readLines(paste0(name, '.sh')) + job_original <- readLines(paste0(name, ".sh")) ############################################################################ # Infer failed task IDs if 'task_ids' is NULL @@ -224,7 +224,7 @@ array_submit <- function(name, task_ids = NULL, submit = FALSE, restore = TRUE, paste0("#SBATCH --array=", paste(task_ids, collapse = ","), "%\\1"), job_original ) - writeLines(job_new, con = paste0(name, '.sh')) + writeLines(job_new, con = paste0(name, ".sh")) # Invoke (sbatch) the modified script if requested if (submit) { @@ -233,8 +233,8 @@ array_submit <- function(name, task_ids = NULL, submit = FALSE, restore = TRUE, } # Restore the original script - if (restore) writeLines(job_original, con = paste0(name, '.sh')) + if (restore) writeLines(job_original, con = paste0(name, ".sh")) # Return the path - return(invisible(paste0(name, '.sh'))) + return(invisible(paste0(name, ".sh"))) } diff --git a/R/job_loop.R b/R/job_loop.R index 04a7f33..e9cc7fc 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 654def7..3f3ac03 100644 --- a/R/job_single.R +++ b/R/job_single.R @@ -56,10 +56,11 @@ #' ## 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) { ## Remove any spaces name <- gsub(" ", "_", name)