-
Notifications
You must be signed in to change notification settings - Fork 386
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
backend: (Part 1) Use DB config values for Deployments during runtime #918
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tianjing-li
requested review from
EugeneLightsOn,
malexw,
ezawadski and
a team
as code owners
January 21, 2025 18:35
tianjing-li
requested a deployment
to
development
January 21, 2025 18:35 — with
GitHub Actions
Waiting
tianjing-li
requested a deployment
to
development
January 21, 2025 18:37 — with
GitHub Actions
Waiting
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #918 +/- ##
==========================================
+ Coverage 77.23% 77.26% +0.03%
==========================================
Files 281 281
Lines 11461 11485 +24
==========================================
+ Hits 8852 8874 +22
- Misses 2609 2611 +2 ☔ View full report in Codecov by Sentry. |
tianjing-li
requested review from
tomtobac,
abimacarmes,
knajjars and
BeatrixCohere
as code owners
January 21, 2025 18:46
tianjing-li
had a problem deploying
to
development
January 21, 2025 18:46 — with
GitHub Actions
Failure
tianjing-li
had a problem deploying
to
development
January 21, 2025 18:56 — with
GitHub Actions
Failure
tianjing-li
had a problem deploying
to
development
January 21, 2025 19:00 — with
GitHub Actions
Failure
tianjing-li
had a problem deploying
to
development
January 21, 2025 19:07 — with
GitHub Actions
Failure
tianjing-li
temporarily deployed
to
development
January 21, 2025 19:14 — with
GitHub Actions
Inactive
tianjing-li
force-pushed
the
update-db-deployment-on-config-change
branch
from
January 23, 2025 00:47
534b48c
to
0485124
Compare
tianjing-li
temporarily deployed
to
development
January 23, 2025 00:49 — with
GitHub Actions
Inactive
EugeneLightsOn
approved these changes
Jan 23, 2025
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.
Looks great.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I noticed while working on https://linear.app/cohereai/issue/TLK-2601/add-update-to-db-config-when-app-starts that in fact the DB values for deployment configs weren't being used at all during runtime. We were instead always defaulting to what was stored in our Pydantic settings.
This PR modifies core behaviour so we store actual keys that reflect what each deployment will fetch in the newly named
get_deployment_config_var
method.AI Description
This PR introduces a new
DeploymentSettingsMixin
class insrc/backend/config/settings.py
, which formats deployment configurations before saving them to the database. The mixin class includes ato_dict
method that retrieves capitalized variable names from a list of strings and returns a new dictionary with these names as keys.The PR also renames several functions and classes to include the word "instance" in their names, indicating a shift towards working with specific instances of deployments rather than general deployment concepts. This change is reflected in the following files:
src/backend/chat/custom/custom.py
src/backend/chat/custom/utils.py
src/backend/config/settings.py
src/backend/crud/deployment.py
src/backend/database_models/deployment.py
src/backend/model_deployments/azure.py
src/backend/model_deployments/bedrock.py
src/backend/model_deployments/cohere_platform.py
src/backend/model_deployments/sagemaker.py
src/backend/model_deployments/single_container.py
src/backend/model_deployments/utils.py
src/backend/routers/utils.py
src/backend/schemas/deployment.py
src/backend/services/deployment.py
src/backend/services/request_validators.py
src/backend/tests/unit/services/test_deployment.py
Additionally, the PR adds a new function,
get_deployment_by_class_name
, tosrc/backend/crud/deployment.py
, which retrieves a deployment by its class name.