-
Notifications
You must be signed in to change notification settings - Fork 2k
Add client-side configuration for deployment concurrency grace period #19489
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
Add client-side configuration for deployment concurrency grace period #19489
Conversation
🤖 Devin AI EngineerI'll be helping with this pull request! Here's what you should know: ✅ I will automatically:
Note: I can only respond to comments from users who have write access to this repository. ⚙️ Control Options:
|
CodSpeed Performance ReportMerging #19489 will not alter performanceComparing Summary
|
38f5016 to
4deadb4
Compare
29ea932 to
4036240
Compare
…period Add `grace_period_seconds` to deployment concurrency options, allowing users to configure how long infrastructure has to start before concurrency slots are released. This addresses #19410 and brings OSS feature parity with Prefect Cloud. Changes: - Add `grace_period_seconds` field to `ConcurrencyOptions` (server) and `ConcurrencyLimitConfig` (client) schemas with validation (60-86400s) - Update `SecureFlowConcurrencySlots` orchestration policy to use the configured grace period, falling back to server setting when not set - Add CLI and YAML support for `grace_period_seconds` in deployments - Add `_extract_concurrency_options` helper to reduce code duplication - Filter None values from serialized concurrency config Example usage in prefect.yaml: ```yaml deployments: - name: my-deployment concurrency_limit: limit: 1 collision_strategy: ENQUEUE grace_period_seconds: 720 ``` Closes #19410 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]> Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com>
9165d40 to
6dd8a71
Compare
desertaxle
left a comment
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.
LGTM!
Overview
Adds client-side configuration for deployment concurrency grace periods, allowing users to control how long infrastructure has to start before concurrency slots are released. This addresses #19410 and brings OSS feature parity with Prefect Cloud.
Previously, the grace period was hardcoded server-side (300s in OSS). Now users can configure it per-deployment via:
prefect.yamldeploymentsflow.deploy()/flow.serve()withConcurrencyLimitConfigChanges
Schema & Models
grace_period_secondsfield toConcurrencyOptions(server schema) andConcurrencyLimitConfig(client schema)concurrency_optionsis already a JSON columnOrchestration
SecureFlowConcurrencySlotspolicy to use configured grace period when creating concurrency leasesconcurrency_optionsas both dict and Pydantic model for backward compatibilityinitial_deployment_lease_duration, default 300s) whenconcurrency_optionsis NoneCLI & Deployment
grace_period_secondstoConcurrencyLimitSpecmodel_run_single_deployto extract and pass through grace period from YAMLRunnerDeploymentto map grace period fromConcurrencyLimitConfigto deployment payloadNonevalues fromconcurrency_limitdictDocumentation
Test Coverage
Added 9 tests covering:
grace_period_secondsAll tests passing locally and in CI (49/51 checks passed, 2 cancelled due to infrastructure issues).
Important Review Points
Fallback behavior: When
concurrency_optionsis None, uses server setting (300s). Whenconcurrency_optionsexists butgrace_period_secondsnot set, uses model default (600s). This difference is intentional but worth verifying.Type handling: Orchestration code handles
concurrency_optionsas both dict and Pydantic model instance. This is necessary for backward compatibility but adds complexity.YAML serialization: Now filters out
Nonevalues fromconcurrency_limitdict to avoid cluttering configs. Verify this doesn't affect other optional fields.Range validation: 60-86400 seconds (1 minute to 1 day). Confirm this range is appropriate for all use cases.
Link to Devin run: https://app.devin.ai/sessions/6a429e264eee42ffa97cffcdd6e0eada
Requested by: Nate Nowack (@zzstoatzz)
Checklist
mint.json. (N/A)