@@ -287,7 +287,6 @@ def __init__(
287
287
self .n_processes = self ._parse_n_processes (n_processes )
288
288
289
289
def _setup_logger (self ) -> logging .Logger :
290
-
291
290
# better safe than sorry
292
291
os .makedirs (self .logfile_dir , exist_ok = True )
293
292
@@ -310,7 +309,6 @@ def _setup_logger(self) -> logging.Logger:
310
309
return logger
311
310
312
311
def _parse_diffcrash_home (self , diffcrash_home ) -> str :
313
-
314
312
diffcrash_home_ok = len (diffcrash_home ) != 0
315
313
316
314
msg = self ._msg_option .format ("diffcrash-home" , diffcrash_home )
@@ -328,7 +326,6 @@ def _parse_diffcrash_home(self, diffcrash_home) -> str:
328
326
return diffcrash_home
329
327
330
328
def _parse_crash_code (self , crash_code ) -> str :
331
-
332
329
# these guys are allowed
333
330
valid_crash_codes = ["dyna" , "radioss" , "pam" ]
334
331
@@ -340,16 +337,14 @@ def _parse_crash_code(self, crash_code) -> str:
340
337
341
338
if not crash_code_ok :
342
339
err_msg = (
343
- f"Invalid crash code '{ crash_code } '. "
344
- f"Please use one of: { str (valid_crash_codes )} "
340
+ f"Invalid crash code '{ crash_code } '. Please use one of: { str (valid_crash_codes )} "
345
341
)
346
342
self .logger .error (err_msg )
347
343
raise RuntimeError (str_error (err_msg ))
348
344
349
345
return crash_code
350
346
351
347
def _parse_reference_run (self , reference_run ) -> str :
352
-
353
348
reference_run_ok = Path (reference_run ).is_file ()
354
349
355
350
msg = self ._msg_option .format ("reference-run" , reference_run )
@@ -364,7 +359,6 @@ def _parse_reference_run(self, reference_run) -> str:
364
359
return reference_run
365
360
366
361
def _parse_use_id_mapping (self , use_id_mapping ) -> bool :
367
-
368
362
msg = self ._msg_option .format ("use-id-mapping" , use_id_mapping )
369
363
print (str_info (msg ))
370
364
self .logger .info (msg )
@@ -386,7 +380,6 @@ def _parse_simulation_runs(
386
380
reference_run : str ,
387
381
exclude_runs : typing .Sequence [str ],
388
382
):
389
-
390
383
# search all denoted runs
391
384
simulation_runs = []
392
385
for pattern in simulation_run_patterns :
@@ -442,19 +435,16 @@ def natural_keys(text):
442
435
return simulation_runs
443
436
444
437
def _parse_config_file (self , config_file ) -> Union [str , None ]:
445
-
446
438
_msg_config_file = ""
447
439
if len (config_file ) > 0 and not Path (config_file ).is_file ():
448
440
config_file = None
449
441
_msg_config_file = f"Can not find config file '{ config_file } '"
450
442
451
443
# missing config file
452
444
else :
453
-
454
445
config_file = None
455
446
_msg_config_file = (
456
- "Config file missing. "
457
- "Consider specifying the path with the option '--config-file'."
447
+ "Config file missing. Consider specifying the path with the option '--config-file'."
458
448
)
459
449
460
450
msg = self ._msg_option .format ("config-file" , config_file )
@@ -468,7 +458,6 @@ def _parse_config_file(self, config_file) -> Union[str, None]:
468
458
return config_file
469
459
470
460
def _parse_parameter_file (self , parameter_file ) -> Union [None , str ]:
471
-
472
461
_msg_parameter_file = ""
473
462
if len (parameter_file ) > 0 and not Path (parameter_file ).is_file ():
474
463
parameter_file = None
@@ -492,7 +481,6 @@ def _parse_parameter_file(self, parameter_file) -> Union[None, str]:
492
481
return parameter_file
493
482
494
483
def _parse_n_processes (self , n_processes ) -> int :
495
-
496
484
print (str_info (self ._msg_option .format ("n-processes" , n_processes )))
497
485
498
486
if n_processes <= 0 :
@@ -640,7 +628,6 @@ def run_import(self, pool: futures.ThreadPoolExecutor):
640
628
# entry 0 is the reference run, thus we start at 1
641
629
# pylint: disable = consider-using-enumerate
642
630
for i_filepath in range (len (self .simulation_runs )):
643
-
644
631
# parameter file missing
645
632
if self .parameter_file is None :
646
633
if self .use_id_mapping :
@@ -691,7 +678,6 @@ def run_import(self, pool: futures.ThreadPoolExecutor):
691
678
return_code_future .done () for return_code_future in return_code_futures
692
679
)
693
680
while n_imports_finished != len (return_code_futures ):
694
-
695
681
# check again
696
682
n_new_imports_finished = sum (
697
683
return_code_future .done () for return_code_future in return_code_futures
@@ -717,7 +703,6 @@ def run_import(self, pool: futures.ThreadPoolExecutor):
717
703
718
704
# print failure
719
705
if any (return_code != 0 for return_code in return_codes ):
720
-
721
706
n_failed_runs = 0
722
707
for i_run , return_code in enumerate (return_codes ):
723
708
if return_code != 0 :
@@ -739,7 +724,6 @@ def run_import(self, pool: futures.ThreadPoolExecutor):
739
724
# check log files
740
725
messages = self .check_if_logfiles_show_success ("DFC_Import_*.log" )
741
726
if messages :
742
-
743
727
# print failure
744
728
msg = f"Running Imports ... done in { time .time () - start_time :.2f} s "
745
729
print (str_error (msg ))
@@ -774,14 +758,12 @@ def run_math(self, pool: futures.ThreadPoolExecutor):
774
758
775
759
start_time = time .time ()
776
760
return_code_future = pool .submit (
777
- run_subprocess ,
778
- [self .diffcrash_home / f"DFC_Math_{ self .crash_code } " , self .project_dir ],
761
+ run_subprocess , [self .diffcrash_home / f"DFC_Math_{ self .crash_code } " , self .project_dir ]
779
762
)
780
763
return_code = return_code_future .result ()
781
764
782
765
# check return code
783
766
if return_code != 0 :
784
-
785
767
msg = f"Running Math ... done in { time .time () - start_time :.2f} s "
786
768
print (str_error (msg ))
787
769
self .logger .error (msg )
@@ -793,7 +775,6 @@ def run_math(self, pool: futures.ThreadPoolExecutor):
793
775
# check logs
794
776
messages = self .check_if_logfiles_show_success ("DFC_MATH*.log" )
795
777
if messages :
796
-
797
778
# print failure
798
779
msg = f"Running Math ... done in { time .time () - start_time :.2f} s "
799
780
print (str_error (msg ))
@@ -889,7 +870,6 @@ def run_export(self, pool: futures.ThreadPoolExecutor):
889
870
# check logs
890
871
messages = self .check_if_logfiles_show_success ("DFC_Export_*" )
891
872
if messages :
892
-
893
873
# print failure
894
874
msg = f"Running Export ... done in { time .time () - start_time :.2f} s "
895
875
print (str_error (msg ))
@@ -900,10 +880,7 @@ def run_export(self, pool: futures.ThreadPoolExecutor):
900
880
print (str_error (msg ))
901
881
self .logger .error (msg )
902
882
903
- msg = (
904
- "At least one export failed. "
905
- f"Please check the log files in '{ self .logfile_dir } '."
906
- )
883
+ msg = f"At least one export failed. Please check the log files in '{ self .logfile_dir } '."
907
884
self .logger .error (msg )
908
885
raise RuntimeError (str_error (msg ))
909
886
@@ -945,7 +922,6 @@ def run_matrix(self, pool: futures.ThreadPoolExecutor):
945
922
946
923
# check return code
947
924
if return_code != 0 :
948
-
949
925
# print failure
950
926
msg = f"Running Matrix ... done in { time .time () - start_time :.2f} s "
951
927
print (str_error (msg ))
@@ -958,7 +934,6 @@ def run_matrix(self, pool: futures.ThreadPoolExecutor):
958
934
# check log file
959
935
messages = self .check_if_logfiles_show_success ("DFC_Matrix_*" )
960
936
if messages :
961
-
962
937
# print failure
963
938
msg = f"Running Matrix ... done in { time .time () - start_time :.2f} s "
964
939
print (str_error (msg ))
@@ -1021,7 +996,6 @@ def run_eigen(self, pool: futures.ThreadPoolExecutor):
1021
996
# check log file
1022
997
messages = self .check_if_logfiles_show_success ("DFC_Matrix_*" )
1023
998
if messages :
1024
-
1025
999
# print failure
1026
1000
msg = f"Running Eigen ... done in { time .time () - start_time :.2f} s "
1027
1001
print (str_error (msg ))
0 commit comments