Skip to content

Commit

Permalink
Fix autotuner script logging logic
Browse files Browse the repository at this point in the history
Output a header if and only if the file is new
  • Loading branch information
bsamseth committed Aug 21, 2024
1 parent d5159b4 commit 1ca2eed
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions stats/autotune/ucituner/cutechess.py
Original file line number Diff line number Diff line change
Expand Up @@ -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):
Expand Down Expand Up @@ -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}"
)
Expand Down

0 comments on commit 1ca2eed

Please sign in to comment.