@@ -199,14 +199,10 @@ function submit!(study::Study; kwargs...)
199199 # If logfile exists, refresh sim_success and append a resume marker. Otherwise
200200 # create a new logfile with header.
201201 if isfile (study. logfile)
202- try
203- update_sim_success_from_log! (study)
204- catch err
205- @warn " failed to refresh study status from existing logfile" error= err
206- end
202+ update_sim_success_from_log! (study)
207203 open (study. logfile, " a" ) do io
208204 datetime = Dates. format (Dates. now (), " yyyy-mm-dd, HH:MM:SS" )
209- write (io, " \n --- RESUMED: $datetime ---\n\n " )
205+ write (io, " \n\n --- RESUMED: $datetime ---\n\n " )
210206 end
211207 else
212208 open (study. logfile, " w+" ) do io
@@ -233,11 +229,12 @@ function submit!(study::Study; kwargs...)
233229 end
234230 continue
235231 end
236- success = false
237232 simtime = @elapsed begin
238- try
233+ success = try
234+ # remove the vtk files from previous failed runs if any
235+ isdir (job. options. vtk) && rm (job. options. vtk; force= true , recursive= true )
239236 submit (job; kwargs... )
240- success = true
237+ true
241238 catch err
242239 # Try to log the error to the job's logfile, but if that fails
243240 # (e.g., invalid path), just continue
@@ -248,6 +245,7 @@ function submit!(study::Study; kwargs...)
248245 catch
249246 # If logging fails, just continue - error will be recorded in job log
250247 end
248+ false
251249 end
252250 end
253251 study. sim_success[i] = success
@@ -277,7 +275,7 @@ last recorded status for each job. This allows resuming processing or submission
277275after an interrupted run.
278276"""
279277function update_sim_success_from_log! (study:: Study )
280- isfile (study. logfile) || return false
278+ isfile (study. logfile) || return nothing
281279
282280 # Read logfile line by line
283281 lines = readlines (study. logfile)
@@ -319,7 +317,7 @@ function update_sim_success_from_log!(study::Study)
319317 study. sim_success[i] = false
320318 end
321319 end
322- return true
320+ return nothing
323321end
324322
325323"""
@@ -383,13 +381,7 @@ See also: [`Study`](@ref), [`submit!`](@ref)
383381"""
384382function process_each_job (f:: F , study:: Study , default_result:: NamedTuple ) where {F}
385383 # Refresh sim_success from logfile if it exists (in case study was interrupted/resumed)
386- if isfile (study. logfile)
387- try
388- update_sim_success_from_log! (study)
389- catch err
390- @warn " failed to refresh study status from logfile before processing" error= err
391- end
392- end
384+ isfile (study. logfile) && update_sim_success_from_log! (study)
393385
394386 results = fill (default_result, length (study. jobs))
395387 for (i, job) in enumerate (study. jobs)
0 commit comments