From c8e071d9676a7953e1b9d84b1b92cfcabfe469c8 Mon Sep 17 00:00:00 2001 From: Nick-Eagles Date: Wed, 4 Oct 2023 15:43:57 -0400 Subject: [PATCH] Add a check for file existence --- R/array_submit.R | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/R/array_submit.R b/R/array_submit.R index 9fda9dc..4908d4f 100644 --- a/R/array_submit.R +++ b/R/array_submit.R @@ -139,7 +139,17 @@ array_submit <- function(job_bash, task_ids = NULL, submit = FALSE, restore = TR # Read in the log for the highest array task to grab the job ID (which # SLURM associates with the entire array) - max_log <- readLines(max_logs[1]) + if (file.exists(max_logs[1])) { + max_log <- readLines(max_logs[1]) + } else { + stop( + paste( + "Could not find the log from the original array job.", + err_string, + sep = "\\n" + ) + ) + } orig_job_id <- max_log[grep("^Job id: ", max_log)] |> str_extract("[0-9]+")