Amir Kamal
07/15/2025, 6:45 AMMarvin
07/15/2025, 6:46 AMMarvin
07/15/2025, 6:47 AMyaml
deployments:
- name: deployment-1
entrypoint: your_flow.py:your_flow
work_pool:
name: your-work-pool
work_queue_name: queue-1
- name: deployment-2
entrypoint: your_flow.py:your_flow
work_pool:
name: your-work-pool
work_queue_name: queue-2
2. Each deployment can target a specific work queue within the work pool using the work_queue_name
parameter.
3. If no work queue is specified, the deployment will use the default work queue of the work pool.
Important notes:
- Work queues must already exist in the work pool before they can be referenced in deployments
- You cannot create new work queues directly through the deployment YAML
- Each deployment can only target one work queue at a time
- Different deployments can use different work queues, even within the same work pool
For more information about deployment configuration and work queues, you can refer to:
- Prefect YAML Configuration Guide
- Work Pools Concept Documentation
Would you like to know more about creating work queues within work pools or managing them through the CLI?Amir Kamal
07/15/2025, 6:54 AMMarvin
07/15/2025, 6:54 AMMarvin
07/15/2025, 6:55 AMyaml
deployments:
- name: my-deployment
entrypoint: flow.py:my_flow
work_pool:
name: my-pool
work_queue_name: my-queue
is_schedule_active: true
tags:
- concurrency-tag # Can be used for tag-based concurrency limits
2. Setting Work Queue Priority and Concurrency:
You can set these when creating a work queue using the CLI:
bash
prefect work-queue create "my-queue" --pool "my-pool" --priority 1 --limit 5
- Priority: Lower numbers = higher priority (e.g., 1 is higher priority than 10)
- Limit: Maximum number of concurrent flow runs
3. Setting Work Pool Concurrency:
bash
prefect work-pool set-concurrency-limit "my-pool" 10
4. Global Concurrency Limits:
You can also set global concurrency limits based on tags:
bash
prefect concurrency-limit create "my-limit" --tag "concurrency-tag" --value 3
Important notes about concurrency and priority:
1. Concurrency Limits:
- Work pool limits apply to all queues within that pool
- Queue-specific limits can't exceed their parent work pool's limit
- Global concurrency limits (based on tags) take precedence
- A value of 0 or null means no limit
2. Priority:
- Priority only affects ordering within a single work queue
- Lower numbers indicate higher priority (1 is highest priority)
- Flows with the same priority are executed in FIFO order
- If not specified, default priority is used
3. Hierarchy:
Global Concurrency Limits
↓
Work Pool Limits
↓
Work Queue Limits
You can manage these settings through:
- Prefect UI
- CLI commands (as shown above)
- Prefect API
Would you like more specific examples for any of these configurations or information about monitoring concurrent runs?Amir Kamal
07/15/2025, 6:56 AMMarvin
07/15/2025, 6:56 AMMarvin
07/15/2025, 6:57 AMyaml
deployments:
- name: my-deployment
work_pool:
name: my-pool
work_queue_name: my-queue # References an existing queue
2. For Concurrency and Priority:
You have two options:
a) Pre-create the work queue with desired settings using the CLI:
bash
prefect work-queue create "my-queue" --pool "my-pool" --limit 5 --priority 1
Then reference it in your YAML as shown above.
b) Use the Prefect API to programmatically set these values before or after deployment.
The reason these settings aren't directly configurable in the YAML is that concurrency limits and priority are properties of the work queue itself, not the deployment. This design allows multiple deployments to share the same work queue while maintaining consistent concurrency and priority settings.
If you're looking to control concurrency at the flow level, you can use:
- Tag-based concurrency limits
- Task-level concurrency limits using the @task(concurrency_limit=N)
decorator
- Flow-level concurrency limits using the @flow(concurrency_limit=N)
decorator
Would you like me to provide more information about any of these alternative approaches to managing concurrency?Amir Kamal
07/15/2025, 7:17 AMMarvin
07/15/2025, 7:17 AMMarvin
07/15/2025, 7:18 AMyaml
deployments:
- name: my-deployment
work_pool:
name: my-pool
work_queue:
name: my-queue
concurrency_limit: 5
priority: 1
This would be a more intuitive and GitOps-friendly way to manage these settings.
2. Current Workaround: In the meantime, you could create a deployment script that:
- First creates/updates the work queue with desired settings
- Then applies the deployment YAML
Example:
python
from prefect.client import get_client
async def setup_deployment():
client = get_client()
# Create/update work queue with settings
await client.create_work_queue(
name="my-queue",
work_pool_name="my-pool",
concurrency_limit=5,
priority=1
)
# Then run deployment
subprocess.run(["prefect", "deploy"])
Would you like me to help you craft a feature request for this functionality, or would you prefer to explore alternative approaches to managing these settings in your current workflow?