diff --git a/drivers/linux/R/manager.R b/drivers/linux/R/manager.R index 472fed05..8ef9092c 100644 --- a/drivers/linux/R/manager.R +++ b/drivers/linux/R/manager.R @@ -21,7 +21,13 @@ do_linux_cancel <- function(scheduler_id, config) { do_linux_submit_pbs <- function(path_batch, id, config, path_root) { - withr::with_dir(path_root, system3("qsub", path_batch, stdout = TRUE)) + res <- withr::with_dir(path_root, system3("qsub", path_batch, stdout = TRUE)) + if (!res$success) { + output <- paste(res$output, collapse = "\n") + cli::cli_abort( + "Job submission failed with code {res$code} and error: {output}") + } + sub(".pbs$", "", res$output) } diff --git a/drivers/linux/R/util.R b/drivers/linux/R/util.R index 19a95181..bb0b2a11 100644 --- a/drivers/linux/R/util.R +++ b/drivers/linux/R/util.R @@ -35,3 +35,13 @@ read_lines <- function(...) { normalize_path <- function(path) { normalizePath(path, winslash = "/", mustWork = TRUE) } + + +system3 <- function(command, args) { + res <- suppressWarnings(system2(command, args, stdout = TRUE, stderr = TRUE)) + code <- attr(res, "status") %||% 0 + attr(res, "status") <- NULL + list(success = code == 0, + code = code, + output = res) +} diff --git a/drivers/linux/inst/templates/pbs/task_run.sh b/drivers/linux/inst/templates/pbs/task_run.sh index 56781cac..4e178c48 100755 --- a/drivers/linux/inst/templates/pbs/task_run.sh +++ b/drivers/linux/inst/templates/pbs/task_run.sh @@ -1,7 +1,8 @@ #!/bin/bash -#PBS -lwalltime={{walltime}} -#PBS -lselect=1:ncpus={{cores}}:mem={{memory}}gb +#PBS -l walltime={{walltime}} +#PBS -l select=1:ncpus={{cores}}:mem={{memory}}gb +#PBS -N {{task_id}} ### This technically makes this driver dependent on easybuild or ### this module system, and other ways would be possible. However, we