Skip to content

Commit 491e865

Browse files
Fix transient errors getting cached
1 parent f5e3723 commit 491e865

1 file changed

Lines changed: 9 additions & 2 deletions

File tree

hwcomponents_cacti/hwcomponents_cacti.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -562,9 +562,16 @@ def read_csv_results(output_path_csv):
562562
return read_csv_results(output_path_csv)
563563
except Exception as e:
564564
self.logger.warning(
565-
f"Error reading CACTI output file {output_path_csv}: {e}"
565+
f"Error reading CACTI output file {output_path_csv}: {e}. "
566+
f"Deleting stale cache and rerunning CACTI."
566567
)
567-
pass
568+
# CACTI opens its output file in append mode, so a stale
569+
# cache error in cache would survive the re-run. Remove
570+
# it first.
571+
try:
572+
os.remove(output_path_csv)
573+
except OSError:
574+
pass
568575

569576
with open(input_path, "w") as f:
570577
f.write("".join(cfg))

0 commit comments

Comments
 (0)