Skip to content

Commit

Permalink
wns_report: fixes
Browse files Browse the repository at this point in the history
Signed-off-by: Øyvind Harboe <[email protected]>
  • Loading branch information
oharboe committed Oct 29, 2024
1 parent a96a942 commit e17a846
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions wns_report.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,9 +70,11 @@ def print_log_dir_times(f):
first = True
totalElapsed = 0
total_max_memory = 0
# print(logdir)

with open(str(f)) as logfile:
if not os.path.exists(f):
return "N/A"

with open(f) as logfile:
found = False
for line in logfile:
elapsedTime = None
Expand Down Expand Up @@ -136,32 +138,42 @@ def main():
set(k for v in sweep.values() for k in v.get("variables", {}).keys())
)

table_data = None
for variant in sweep:
def read_file(variant):
with open(
os.path.join(os.path.dirname(sweep_file), "BoomTile_" + variant + ".txt"),
"r",
) as file:
report = file.read()
stats = parse_stats(report)
names = sorted(stats.keys())
return file.read()

stats = {variant: parse_stats(read_file(variant)) for variant in sweep}
names = sorted({name for stat in stats.values() for name in stat.keys()})
variable_names = sorted(
set(k for v in sweep.values() for k in v.get("variables", {}).keys())
)

table_data = None
for variant in sweep:
if table_data is None:
table_data = [
["Variant", "Description"] + names + variables + ["dissolve"] + logs
["Variant", "Description"]
+ names
+ variable_names
+ ["dissolve"]
+ logs
]
variables = sweep[variant].get("variables", {})
table_data.append(
(
[variant, sweep[variant].get("description", "")]
+ [stats[name] for name in names]
+ [stats[variant][name] for name in names]
+ [
(
variables.get(variable, "")
if sweep_json["base"].get(variable, "")
!= variables.get(variable, "")
else ""
)
for variable in variables
for variable in variable_names
]
+ [" ".join(sweep[variant].get("dissolve", []))]
+ [
Expand Down

0 comments on commit e17a846

Please sign in to comment.