Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes to tools/zarr-cache-stats.py #184

Merged
merged 1 commit into from
Aug 20, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 6 additions & 4 deletions tools/zarr-cache-stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,7 +192,11 @@ def process_logs(logfiles: Iterable[Path]) -> Events:
entry = json.loads(lg.message)
timestamp = datetime.fromisoformat(entry["timestamp"])
fields = entry.get("fields", {})
if "cache_event" in fields and fields.get("cache") == "zarr-manifests":
if (
"cache_event" in fields
and fields["cache_event"] not in ("dump", "dump-error")
and fields.get("cache") == "zarr-manifests"
):
span_id: str | None = entry.get("span", {}).get("id")
manifest_path: str = fields["manifest"]
match fields["cache_event"]:
Expand Down Expand Up @@ -248,8 +252,6 @@ def process_logs(logfiles: Iterable[Path]) -> Events:
)
)
last_accesses.pop(manifest_path, None)
case "dump" | "dump-error":
pass
case other:
log.warning(
"Invalid 'cache_event' field value %r: %s", other, lg.line
Expand Down Expand Up @@ -291,7 +293,7 @@ def summarize(events: Events) -> None:

evict_stats = Counter(ev.cause for ev in events.evictions)
print("Eviction causes:")
for cause, qty in sorted(evict_stats.items()):
for cause, qty in sorted(evict_stats.items(), key=lambda p: p[0].name):
print(f" {cause}: {qty}")


Expand Down