To achieve your desired concurrency logic in Prefect 3.x, you can use global concurrency limits. Here's a concise plan:
1.
Define Global Concurrency Limit: Set a total concurrency limit of 60 slots for all flows combined. This ensures that no more than 60 flows run simultaneously across all types.
2.
Define Per-Flow Type Limits: For each flow type (A, B, and C), set a concurrency limit of 20 slots. This means that if all three flow types have jobs queued, each can utilize up to 20 slots.
3.
Dynamic Slot Allocation: If one flow type is not fully utilizing its 20 slots, the remaining slots can be used by other flow types. Prefect's concurrency management will handle this dynamic allocation based on the current demand and availability.
4.
Slot Decay (Optional): You can configure slot decay to control how quickly slots become available again after being used. This is useful if you want to implement a "rate limiting" effect. For example, setting a
slot_decay_per_second
parameter can adjust how quickly slots refresh.
For more detailed information on configuring these settings, you can refer to the
Prefect documentation on global concurrency limits.
If you need further details on the API or implementation specifics, you can explore Prefect's
top-level API for additional functions and classes that might be useful.