Skip to content

refactor[lru shared cache]: Shared object _resources now lru dict#55

Merged
winsomeglint merged 8 commits into
mainfrom
lsummerbell/lru-shared-resources
Jun 22, 2026
Merged

refactor[lru shared cache]: Shared object _resources now lru dict#55
winsomeglint merged 8 commits into
mainfrom
lsummerbell/lru-shared-resources

Conversation

@winsomeglint

Copy link
Copy Markdown
Contributor
  • The Shared object now stores _resources in an lru-dict LRU dictionary with explicit size limits and eviction callbacks
  • A component_teardown function can be passed to Shared as an eviction callback that will call exit on 'AbstractContextManager` resources

@winsomeglint winsomeglint force-pushed the lsummerbell/lru-shared-resources branch from fb4c1f0 to 0c6d7b5 Compare June 22, 2026 09:21
@winsomeglint winsomeglint force-pushed the lsummerbell/lru-shared-resources branch from 577f09f to b863a6c Compare June 22, 2026 10:50
Comment thread datashare-python/pyproject.toml Outdated
"temporalio~=1.23",
"typer>=0.15.4,<0.25.1",
"tomlkit~=0.14.0",
"lru-dict>=1.4.1",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
"lru-dict>=1.4.1",
"lru-dict~=1.4",

Comment thread workers/workflows-worker/pyproject.toml Outdated
"typer==0.24.0",
]

[tool.uv.sources]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This repo is only built for when building the docker image when we don't want to install locally but from PyPi

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

okay. the tests will error out before we merge and datashare-python is updated.

Comment thread workers/workflows-worker/pyproject.toml Outdated
"datashare-asr-worker==0.8.14",
"datashare-extract-worker[base]==0.1.37",
"datashare-python~=0.8.23",
"datashare-python~=0.8.25",

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is bumped automatically by the CI when releasing a new version of datashare-python


TIKA_METADATA_RESOURCENAME = "tika_metadata_resourcename"

DEFAULT_SHARED_RESOURCES_SIZE = 2

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would disable caching of more that 1 model by default.

@winsomeglint winsomeglint merged commit 1c2167d into main Jun 22, 2026
11 checks passed
@winsomeglint winsomeglint deleted the lsummerbell/lru-shared-resources branch June 22, 2026 12:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants