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

Improve deployment concurrency GCL management #15426

Merged
merged 24 commits into from
Sep 19, 2024

Conversation

collincchoy
Copy link
Contributor

@collincchoy collincchoy commented Sep 18, 2024

Closes #15375

This PR includes several changes to support shifting the int-based Deployment.concurrency_limit over to a foreign key relationship between Deployment and ConcurrencyLimitV2 in order to centralize the source of truth for a deployment's concurrency limit value.

More specifically, this PR:

  • Adds a new deployment.concurrency_limit_id column that is a nullable FK to concurrency_limit_v2.id. The migration will try to backfill pre-existing data
  • Updates deployment APIs (create/upsert, update, delete) to manage a related global concurrency limit object based on requested deployment.concurrency_limit int values
  • Updates deployment API responses to include an expanded global_concurrency_limit object which includes the backing limit integer in addition to other fields like the underlying GCL's name
  • Updates worker deployment-concurrency-limiting behavior to directly use the deployment's related GCL via the API response's nested GCL name rather than relying on an editable naming convention / upserting-at-runtime
  • Updates runner deployment-concurrency-limiting behavior to directly use the deployment's related GCL via the API response's nested GCL name rather than relying on an editable naming convention / upserting-at-runtime
  • Adds deprecation notes for:
    • the int-based deployment.concurrency_limit DB column is now deprecated. The column still exists for now and is being written to but no longer read.
    • the int-based deployment.concurrency_limit API response field is now deprecated. This field will still be returned from deployment APIs, but it will always be None for client-side compatibility.
    • the int-based DeploymentConcurrencyLimitFilter for filtering deployments via the /filter API. This still exists so as to not 422 on clients using this filter, but the filter will have no effect.

Checklist

  • This pull request references any related issue by including "closes <link to issue>"
    • If no issue exists and your change is not a small fix, please create an issue first.
  • If this pull request adds new functionality, it includes unit tests that cover the changes
  • If this pull request removes docs files, it includes redirect settings in mint.json.
  • If this pull request adds functions or classes, it includes helpful docstrings.

@github-actions github-actions bot added enhancement An improvement of an existing feature docs migration labels Sep 18, 2024
Copy link

codspeed-hq bot commented Sep 18, 2024

CodSpeed Performance Report

Merging #15426 will not alter performance

Comparing deployment-concurrency/improve-deployment-gcl-mgmt (9a75b80) with main (bb96af8)

Summary

✅ 3 untouched benchmarks

@collincchoy collincchoy changed the title Deployment concurrency/improve deployment gcl mgmt Improve deployment concurrency GCL management Sep 18, 2024
@collincchoy collincchoy marked this pull request as ready for review September 18, 2024 22:51
@@ -293,7 +293,7 @@ async def test_project_deploy(self, project_dir, prefect_client):
assert deployment.work_pool_name == "test-pool"
assert deployment.version == "1.0.0"
assert deployment.tags == ["foo-bar"]
assert deployment.concurrency_limit == 42
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that you can still access deployment.concurrency_limit but it's now deprecated so it emits a warning on access and also it will be None.

Copy link
Member

@desertaxle desertaxle left a comment

Choose a reason for hiding this comment

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

I have a couple of questions about if/when we'll be able to remove fields deprecated in this PR, but otherwise LGTM!

src/prefect/client/schemas/filters.py Outdated Show resolved Hide resolved
src/prefect/client/schemas/responses.py Outdated Show resolved Hide resolved
@collincchoy collincchoy merged commit 4ee7d12 into main Sep 19, 2024
30 checks passed
@collincchoy collincchoy deleted the deployment-concurrency/improve-deployment-gcl-mgmt branch September 19, 2024 23:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs enhancement An improvement of an existing feature migration
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Improve global concurrency limit management for deployment concurrency limiting
2 participants