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

feat: db pool for histogram calc #174

Merged
merged 6 commits into from
Sep 16, 2023
Merged

feat: db pool for histogram calc #174

merged 6 commits into from
Sep 16, 2023

Conversation

cabreraalex
Copy link
Member

Description

Actually use asyncio for DB calculations using an async DB pool. Speeds up by a factor of features being calculated, e.g. 5x for translation.

@cabreraalex
Copy link
Member Author

okay this is actually ready now. Very odd asyncio event loop issues in prod I was dealing with.

CMD exec poetry run uvicorn zeno_backend.server:get_server --reload --host 0.0.0.0 --port 80
Copy link
Member Author

Choose a reason for hiding this comment

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

Running it as a module didn't create an event loop in asyncio oddly. Also matches the dev setup.

return db


db_pool = AsyncConnectionPool(" ".join([f"{k}={v}" for k, v in config().items()]))
Copy link
Member Author

Choose a reason for hiding this comment

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

Eventually probably want to switch most queries to this, but it's okay to have both for now IMO

@cabreraalex cabreraalex merged commit 32dbcf2 into main Sep 16, 2023
6 checks passed
@cabreraalex cabreraalex deleted the pool branch September 16, 2023 17:58
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