[CLEAN] Synthetic Benchmark PR #19489 - Add client-side configuration for deployment concurrency grace period #168
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.
Benchmark PR PrefectHQ#19489
Type: Clean (correct implementation)
Original PR Title: Add client-side configuration for deployment concurrency grace period
Original PR Description:
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)Original PR URL: Add client-side configuration for deployment concurrency grace period PrefectHQ/prefect#19489