From 1ca2eeda02f4fa663c49f8cd1c573b323a3cc46a Mon Sep 17 00:00:00 2001 From: Bendik Samseth Date: Sun, 18 Aug 2024 09:46:57 +0200 Subject: [PATCH] Fix autotuner script logging logic Output a header if and only if the file is new --- stats/autotune/ucituner/cutechess.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/stats/autotune/ucituner/cutechess.py b/stats/autotune/ucituner/cutechess.py index 7ad6dd1..91a3bc8 100644 --- a/stats/autotune/ucituner/cutechess.py +++ b/stats/autotune/ucituner/cutechess.py @@ -14,7 +14,8 @@ def __init__(self, config: Config) -> None: self.config = config with open(self.config.log_csv_path, "a") as f: writer = csv.writer(f) - # writer.writerow(list(self.config.parameter_ranges.keys())) + if f.tell() == 0: + writer.writerow(list(self.config.parameter_ranges.keys())) writer.writerow([v.start for v in self.config.parameter_ranges.values()]) def update(self): @@ -66,7 +67,7 @@ def update(self): print(line) result.stdout.close() - if result.returncode != 0: + if result.returncode: print( f"WARNING: cutechess-cli exited with non zero code: {result.returncode}" )