-
Notifications
You must be signed in to change notification settings - Fork 161
chore(BA-1005): Migrate to pydantic in manager configuration #3994
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR migrates the manager configuration to use pydantic by introducing new models for managing volume configuration.
- Added pydantic models for virtual folder types (VFolderTypeConfig) and proxies (VFolderProxyConfig).
- Introduced a VolumeConfig model consolidating configuration details for virtual folders and volume proxies.
Comments suppressed due to low confidence (1)
src/ai/backend/manager/config/volume.py:72
- [nitpick] The default factory for '_types' in VolumeConfig only sets a default value for 'user' but leaves 'group' as None. If both configurations are intended to be initialized similarly, consider providing a default for 'group' as well.
default_factory=lambda: VFolderTypeConfig(user={}),
667c5cc
to
01796c3
Compare
pool_size: int = Field( | ||
default=8, | ||
ge=1, | ||
description=""" | ||
Size of the database connection pool. | ||
Determines how many concurrent database connections to maintain. | ||
Should be tuned based on expected load and database server capacity. | ||
""", | ||
examples=[1, 8], | ||
) | ||
pool_recycle: float = Field( | ||
default=-1, | ||
ge=-1, | ||
description=""" | ||
Maximum lifetime of a connection in seconds before it's recycled. | ||
Set to -1 to disable connection recycling. | ||
Useful to handle cases where database connections are closed by the server after inactivity. | ||
""", | ||
examples=[-1, 50], | ||
) | ||
pool_pre_ping: bool = Field( | ||
default=False, | ||
description=""" | ||
Whether to test connections with a lightweight ping before using them. | ||
Helps detect stale connections before they cause application errors. | ||
Adds a small overhead but improves reliability. | ||
""", | ||
examples=[True], | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you leave the SQLAlchemy reference of the settings?
More refs are here.
pool_recycle , pool_pre_ping
default=False, | ||
description=""" | ||
Whether to use the experimental Redis-based event dispatcher. | ||
May provide better performance for event handling in large clusters. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The reason we implemented this dispatcher is because the redis-py async module seems to have issues. (It is not because of performance)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Most of the descriptions are written by the copilot, but I'll check the whole thing once.
Limits the complexity of queries to prevent abuse. | ||
Set to None to disable the limit. | ||
""", | ||
examples=[None, 10, 15], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How does pydantic.Field
convert null value to None
? Users should be able to set null values through config explicitly
459a517
to
7e93d9d
Compare
resolves #3993 (BA-1005)
Checklist: (if applicable)
ai.backend.test
docs
directory