Skip to content

fix: Add deploy concurrency option and preserve default work pool behavior for multi-deploy#22326

Open
hemantmm wants to merge 5 commits into
PrefectHQ:mainfrom
hemantmm:deploy-concurrency-default-work-pool
Open

fix: Add deploy concurrency option and preserve default work pool behavior for multi-deploy#22326
hemantmm wants to merge 5 commits into
PrefectHQ:mainfrom
hemantmm:deploy-concurrency-default-work-pool

Conversation

@hemantmm

Copy link
Copy Markdown
Contributor

closes: #19096

Summary

This PR introduces a --deploy-concurrency option to prefect deploy to control the number of deployments created concurrently when deploying multiple deployments.

Additionally, it preserves the existing behavior of applying the configured default work pool to deployment configurations that do not explicitly specify one, while avoiding unnecessary warnings when the default pool originates from settings.

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 the enhancement An improvement of an existing feature label Jun 18, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e9cb92a09d

ℹ️ About Codex in GitHub

Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +549 to +551
await asyncio.gather(
*(deploy_with_limit(config) for config in validated_configs),
)

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve fail-fast behavior when concurrency is one

With the default concurrency=1, this schedules every deployment coroutine up front; if one _run_single_deploy raises, asyncio.gather propagates the exception but does not cancel the other awaitables, and releasing the semaphore can let the next config enter _run_single_deploy before the CLI exits. In a multi-deploy where an earlier deployment fails, later deployments can still be created/updated, regressing the previous sequential fail-fast behavior and causing unexpected partial deploys after the reported failure.

Useful? React with 👍 / 👎.

@codspeed-hq

codspeed-hq Bot commented Jun 18, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 8 untouched benchmarks
⏩ 1 skipped benchmark1


Comparing hemantmm:deploy-concurrency-default-work-pool (8877263) with main (8902f5b)

Open in CodSpeed

Footnotes

  1. 1 benchmark was skipped, so the baseline result was used instead. If it was deleted from the codebase, click here and archive it to remove it from the performance reports.

hemantmm added 4 commits June 18, 2026 22:18
Signed-off-by: Hemant M Mehta <hemant29mehta@gmail.com>
Signed-off-by: Hemant M Mehta <hemant29mehta@gmail.com>
Signed-off-by: Hemant M Mehta <hemant29mehta@gmail.com>
Signed-off-by: Hemant M Mehta <hemant29mehta@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement An improvement of an existing feature

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support Concurrenct Deployment creation

1 participant