@@ -145,12 +145,10 @@ function gap(a::Array{Int,1})
145
145
end
146
146
147
147
""" Checks output folders to determine a 4-digit run id number."""
148
- function get_run_id_path ( S:: ModelSetup ,
149
- order:: String = " continue" ,
150
- run_id:: Union{Int,Nothing} = nothing )
151
-
152
- @unpack output,outpath = S. parameters
148
+ function get_run_id_path (S:: ModelSetup )
153
149
150
+ @unpack output,outpath,get_id_mode = S. parameters
151
+
154
152
if output
155
153
runlist = filter (x-> startswith (x," run" ),readdir (outpath))
156
154
existing_runs = [parse (Int,id[4 : end ]) for id in runlist]
@@ -159,26 +157,26 @@ function get_run_id_path( S::ModelSetup,
159
157
mkdir (runpath)
160
158
return 0 ,runpath
161
159
else # create next folder
162
- if order == " fill" # find the smallest gap in runfolders
160
+ if get_id_mode == " fill" # find the smallest gap in runfolders
163
161
run_id = gap (existing_runs)
164
162
runpath = joinpath (outpath," run" * @sprintf (" %04d" ,run_id))
165
163
mkdir (runpath)
166
164
167
- elseif order == " specific" # specify the run_id as input argument
168
- runpath = joinpath (outpath," run" * @sprintf (" %04d" ,run_id))
169
- try # create folder if not existent
170
- mkdir (runpath)
171
- catch # else rm folder and create new one
172
- rm (runpath,recursive= true )
173
- mkdir (runpath)
174
- end
165
+ # elseif order == "specific" # specify the run_id as input argument
166
+ # runpath = joinpath(outpath,"run"*@sprintf("%04d",run_id))
167
+ # try # create folder if not existent
168
+ # mkdir(runpath)
169
+ # catch # else rm folder and create new one
170
+ # rm(runpath,recursive=true)
171
+ # mkdir(runpath)
172
+ # end
175
173
176
- elseif order == " continue" # find largest folder and count one up
174
+ elseif get_id_mode == " continue" # find largest folder and count one up
177
175
run_id = maximum (existing_runs)+ 1
178
176
runpath = joinpath (outpath," run" * @sprintf (" %04d" ,run_id))
179
177
mkdir (runpath)
180
178
else
181
- throw (error (" Order '$order ' is not valid for get_run_id_path(), chose continue, specific or fill." ))
179
+ throw (error (" Order '$get_id_mode ' is not valid for get_run_id_path(), choose continue or fill." ))
182
180
end
183
181
return run_id,runpath
184
182
end
0 commit comments