@@ -98,14 +98,12 @@ mod_SLURM <- function(
9898 " HPC_partition" , " path_Hmsc" , " ProjNum" , " Path_GPU_Check" ,
9999 " command_prefix" , " SLURM_prefix" )
100100 IASDT.R :: check_args(
101- args_all = AllArgs , args_to_check = CharArgs ,
102- args_type = " character" )
101+ args_all = AllArgs , args_to_check = CharArgs , args_type = " character" )
103102
104103 # numeric arguments
105104 NumericArgs <- c(" gpus_per_node" , " cpus_per_task" , " ntasks" )
106105 IASDT.R :: check_args(
107- args_all = AllArgs , args_to_check = NumericArgs ,
108- args_type = " numeric" )
106+ args_all = AllArgs , args_to_check = NumericArgs , args_type = " numeric" )
109107
110108 rm(AllArgs , envir = environment())
111109
@@ -131,15 +129,27 @@ mod_SLURM <- function(
131129 .x = seq_len(NCommandFiles ),
132130 .f = function (x ) {
133131
134- if (NCommandFiles == 1 ) {
135- OutFile <- paste0(SLURM_prefix , " .slurm" )
136- JobName0 <- job_name
132+ SLURM_suffix <- basename(ListCommands [x ]) %> %
133+ stringr :: str_remove_all(
134+ paste0(c(command_prefix , " CV_" , " .txt" ), collapse = " |" )) %> %
135+ stringr :: str_remove_all(" ^_" )
136+
137+ if (nchar(SLURM_suffix ) > 0 ) {
138+ OutFile <- c(SLURM_prefix , SLURM_suffix ) %> %
139+ paste0(collapse = " _" ) %> %
140+ paste0(" .slurm" )
141+ JobName0 <- stringr :: str_remove_all(OutFile , " _Fit|_Bash|.slurm$" )
137142 } else {
138- OutFile <- paste0(SLURM_prefix , " _" , x , " .slurm" )
139- JobName0 <- paste0(job_name , " _" , x )
143+ if (NCommandFiles == 1 ) {
144+ OutFile <- paste0(SLURM_prefix , " .slurm" )
145+ JobName0 <- job_name
146+ } else {
147+ OutFile <- paste0(SLURM_prefix , " _" , x , " .slurm" )
148+ JobName0 <- paste0(job_name , " _" , x )
149+ }
140150 }
141- NJobs <- R.utils :: countLines(ListCommands [x ])[1 ]
142151
152+ NJobs <- R.utils :: countLines(ListCommands [x ])[1 ]
143153
144154 # create connection to SLURM file
145155
0 commit comments