Skip to content

Commit d0a87ea

Browse files
Fix multi tries duration result extraction from traces (#34)
When benchmarking with traces, each event generated does not contain a run_id field, and it is therefore not possible to aggregate the all events according to their run ids. This commit removes all logic related to run_ids. Co-authored-by: Boon Jun Soh <boonjun@google.com>
1 parent a8a68bb commit d0a87ea

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/benchmark_utils.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -74,16 +74,11 @@ def get_metrics_from_trace(trace: dict[str, Any], task: str) -> float:
7474
if "name" in e and event_matcher.match(e["name"]):
7575
events.append(e)
7676

77-
events_by_run_id = defaultdict(list)
78-
for e in events:
79-
run_id = e["args"]["run_id"] if "args" in e and "run_id" in e["args"] else "0"
80-
events_by_run_id[run_id].append(e)
8177
durations_ms = []
8278
try:
8379
# Duration is in us.
84-
durations_ms = [
85-
max([e["dur"] for e in es]) / 1e3 for run_id, es in events_by_run_id.items()
86-
]
80+
for e in events:
81+
durations_ms.append(e["dur"] / 1e3)
8782
except KeyError:
8883
print("KeyError: Key 'dur' not found in the event object")
8984
raise

0 commit comments

Comments
 (0)