Skip to content

Commit a934fb4

Browse files
authored
fix async lru cache (#3262)
1 parent 626b264 commit a934fb4

File tree

14 files changed

+201
-31
lines changed

14 files changed

+201
-31
lines changed

front/admin_ui/poetry.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jobs/cache_maintenance/poetry.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

jobs/mongodb_migration/poetry.lock

Lines changed: 14 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/libapi/poetry.lock

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/libcommon/poetry.lock

Lines changed: 13 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

libs/libcommon/pyproject.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ torch = [
4747
# that platform
4848
torchcodec = { version = "0.7.0", markers = "sys_platform != 'linux' or platform_machine != 'aarch64'" }
4949
tqdm = "^4.66.3"
50+
async-lru = "^2.0.5"
5051

5152
[tool.poetry.group.libviewer]
5253
optional = true

libs/libcommon/src/libcommon/parquet_utils.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
import os
44
from collections.abc import Iterable
55
from dataclasses import dataclass, field
6-
from functools import lru_cache, partial
6+
from functools import partial
77
from pathlib import Path
88
from typing import Optional, TypedDict
99
from urllib.parse import unquote
@@ -13,6 +13,7 @@
1313
import pyarrow as pa
1414
import pyarrow.compute as pc
1515
import pyarrow.parquet as pq
16+
from async_lru import alru_cache
1617
from datasets import Features, Value
1718
from datasets.table import cast_table_to_schema
1819
from datasets.utils.py_utils import size_str
@@ -526,7 +527,7 @@ def _init_viewer_index(
526527
)
527528

528529
# note that this cache size is global for the class, not per instance
529-
@lru_cache(maxsize=1)
530+
@alru_cache(maxsize=1)
530531
async def query(self, offset: int, length: int) -> tuple[pa.Table, list[str]]:
531532
"""Query the parquet files
532533

services/admin/poetry.lock

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/api/poetry.lock

Lines changed: 15 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

services/rows/poetry.lock

Lines changed: 26 additions & 11 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)