Fredrik Hoem Grelland
11/04/2025, 7:44 AMprefect api GET v2/concurrency_limits/tag:my_task is only showing "active_slots", but not the task holding the slotMarvin
11/04/2025, 7:45 AMMarvin
11/04/2025, 7:49 AMactive_slots array of TaskRun IDs, not the human-readable task name. To see which task/flow is holding each slot, look up those TaskRun IDs.
Two easy ways:
- CLI
- List slot holders:
prefect concurrency-limit inspect tag:my_task
This shows active_slots as a list of TaskRun IDs.
- Inspect each task run to see the task name and flow:
prefect task-run inspect <task_run_id>
If you want more detail on the parent flow:
prefect flow-run inspect <flow_run_id>
- REST API
- Read the concurrency limit (shows TaskRun IDs):
GET /api/v2/concurrency_limits/tag:my_task
- For each ID in active_slots, fetch the task run:
GET /api/v2/task_runs/<task_run_id>
The response includes fields like name (task name) and flow_run_id so you can trace it back to the flow.
Helpful docs:
- CLI: concurrency-limit
- REST: read concurrency limit by tag
- REST: read task run
Notes:
- There isn’t a UI page that directly lists current slot holders; the CLI/API approach above is the way to go.
- If you’re looking at global concurrency limits (not tag-based), those may report active_slots as a count rather than a list of IDs. For tag-based limits like tag:my_task, you’ll get the TaskRun IDs.
If you want, I can share a quick script to print task names and parent flow runs for all current holders of tag:my_task.Fredrik Hoem Grelland
11/04/2025, 8:04 AMMarvin
11/04/2025, 8:04 AMMarvin
11/04/2025, 8:10 AMprefect concurrency-limit inspect tag:my_task
prefect task-run inspect <task_run_id>
- REST:
GET /api/v2/concurrency_limits/tag:my_task
GET /api/v2/task_runs/<task_run_id>
- Docs: CLI: concurrency limits • REST: read tag-based limit • REST: read task run
- If you’re using a global (v2) concurrency limit: the API will only show an integer count of active_slots. There’s no built-in mapping to the specific task/flow holders. As a workaround, you can query task runs that are likely subject to the limit (e.g., by tag or other criteria) and are RUNNING to approximate who is occupying slots. Example REST filter for tag-based tasks currently running:
POST /api/v2/task_runs/filter
{
"task_runs": {
"tags": {"all_": ["my_task"]}
},
"task_run_states": {
"type": {"any_": ["RUNNING"]}
},
"limit": 200
}
Docs: How-to: global concurrency limits • REST: read global (v2) limit • REST: read task runs
If you can share which type of limit you’ve created (tag-based vs global v2) and the JSON you get back from your endpoint, I can give you an exact set of steps or a short script to list the holders (or the best-possible approximation for global v2).