Skip to content

Commit

Permalink
make sure log is preserved in case of requeueing
Browse files Browse the repository at this point in the history
  • Loading branch information
orichters committed Sep 19, 2023
1 parent ffcd255 commit e1f5218
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 0 additions & 2 deletions scripts/start/prepareAndRun.R
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@ prepareAndRun <- function() {
} else {
# If "full.gms" exists, the script assumes that a full.gms has been generated before and you want
# to restart REMIND in the same folder using the gdx that it eventually previously produced.
message("\nRestarting REMIND, find old log in 'log_beforeRestart.txt'.")
if (file.exists("log.txt")) file.copy("log.txt", "log_beforeRestart.txt", overwrite = TRUE)
if (file.exists("fulldata.gdx")) file.copy("fulldata.gdx", "input.gdx", overwrite = TRUE)
}

Expand Down
6 changes: 5 additions & 1 deletion scripts/start/submit.R
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,13 @@ submit <- function(cfg, restart = FALSE, stopOnFolderCreateError = TRUE) {
if (grepl("^direct", cfg$slurmConfig) || ! isSlurmAvailable()) {
exitCode <- system("Rscript prepareAndRun.R")
} else {
if (file.exists("log.txt")) {
message("\nRestarting REMIND, find old log in 'log_beforeRestart.txt'.")
file.rename("log.txt", "log_beforeRestart.R")
}
exitCode <- system(paste0("sbatch --job-name=",
cfg$title,
" --output=log.txt",
" --output=log.txt --open-mode=append", # append for requeued jobs
" --mail-type=END",
" --comment=REMIND",
" --wrap=\"Rscript prepareAndRun.R \" ",
Expand Down

0 comments on commit e1f5218

Please sign in to comment.