Skip to content
Snippets Groups Projects
Commit b69f943c authored by David Klein's avatar David Klein
Browse files

Allow providing additional SLURM parameters via cfg$slurmConfig. Parameters...

Allow providing additional SLURM parameters via cfg$slurmConfig. Parameters that are later provided interactively via start.R overwrite the cfg values. Closing #139
parent c5bd3759
No related branches found
No related tags found
1 merge request!155A coupled of fixes and improvements to the start scripts
......@@ -69,3 +69,44 @@ choose_slurmConfig <- function() {
return(comp)
}
# combine_slurmconfig takes two strings with SLURM parameters (e.g. "--qos=priority --time=40000")
# and combines them into one sting of SLURM parameters overwriting the parameters in "original"
# if they also exist in "update_with".
combine_slurmConfig <- function (original, update_with) {
# trim whitespaces
original <- trimws(original)
update_with <- trimws(update_with)
# remove double whitespaces
original <- gsub("\\s+"," ",original)
update_with <- gsub("\\s+"," ",update_with)
# if user chose "direct" dont update any slurm commands
if(update_with == "direct") return(update_with)
# ignore original if it is "direct"
if (original == "direct") original <- ""
# put RHS strings into vector
v_update_with <- gsub("--.*=(.*)","\\1",unlist(strsplit(update_with,split=" ")))
# name the vector using LHS strings
names(v_update_with) <- gsub("--(.*)=.*","\\1",unlist(strsplit(update_with,split=" ")))
# put RHS strings into vector
v_original <- gsub("--.*=(.*)","\\1",unlist(strsplit(original,split=" ")))
# name the vector using LHS strings
names(v_original) <- gsub("--(.*)=.*","\\1",unlist(strsplit(original,split=" ")))
# remove elements from "original" that are existing in "update_with"
v_original <- v_original[!names(v_original) %in% "qos"]
combined <- c(v_update_with,v_original)
# concatenate SLURM command (insert "--" and "=")
res <- paste(paste0("--",names(combined),"=",combined),collapse = " ")
return(res)
}
......@@ -196,7 +196,7 @@ if ('--restart' %in% argv) {
for (outputdir in outputdirs) {
cat("Restarting",outputdir,"\n")
load(paste0("output/",outputdir,"/config.Rdata")) # read config.Rdata from results folder
cfg$slurmConfig <- slurmConfig # update the slurmConfig setting to what the user just chose (it was being ignored before)
cfg$slurmConfig <- combine_slurmConfig(cfg$slurmConfig,slurmConfig) # update the slurmConfig setting to what the user just chose (it was being ignored before)
submit(cfg, restart = TRUE)
#cat(paste0("output/",outputdir,"/config.Rdata"),"\n")
}
......@@ -238,7 +238,7 @@ if ('--restart' %in% argv) {
source("config/default.cfg")
# Have the log output written in a file (not on the screen)
cfg$slurmConfig <- slurmConfig
cfg$slurmConfig <- combine_slurmConfig(cfg$slurmConfig,slurmConfig)
cfg$logoption <- 2
start_now <- TRUE
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment