-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
Modernize Database layer #7591
Comments
I think what you wrote is mostly correct. Dataclasses is a welcome addition. One problem with asyncio is that Twisted doesn't work well with it and needs hacks, at least the last time I checked. Also, last time I checked there's no way to write asyncio tests that mock the clock. So for now I would like to not introduce asyncio as much as possible. So about your suggestions:
Seems great, please go ahead.
Also seems great. I think what you did in #7598 is the way to go. I just need to think a bit about migrations because this is part of public API. Is it possible to override |
Absolutely. In fact, it's what I did in the beginning before removing it in the last commit. def __getitem__(self, key: str):
if hasattr(self, key):
return getattr(self, key)
raise KeyError(key) I'll remove the commit, and maybe add a deprecation warning? As for the AsyncEngine, I think it's perfectly fine to postpone this. Current implementation using threads is perfectly fine, so using async would be of little gain. |
Yes, please do. |
As per #7385 , I'm adding type information here and there as I work on other things.
One thing I'm noticing is that the database models do not have mapped python classes to interact, which would help typing. Is that by choice or a legacy implementation?
If I understand the code correctly, database data is passed around as
dict
which then need tests to validate that the data is as expected withValidator
(defined here)?Some things that could be done from the top of my head:
Also, it seems DB queries are run from a threadpool, an obvious reason is that queries are synchronous. If there is no other reason, SQLAlchemy 1.4.3 (March 2021) introduced asyncio support at a beta level (although there is bugfixes as recently as a critical one in 1.4.51 (Jan 2024), so there is reason to hold off on it.
Here is as far as I got looking into it for now. As I don't have a good understanding of Buildbot's internals nor history, I wanted to get maintainers opinion on this. I'm willing to submit PRs on this (hopefully, finding a way to make them as small as possible).
The text was updated successfully, but these errors were encountered: