Maintenance: Planio will be observing a scheduled maintenance window this Tuesday, November 5, 2024 from 03:00 UTC until 06:30 UTC to perform urgent network maintenance in our primary data center. Your Planio account will be unavailable during this maintenance window.
Story #9380
closedAs a plugin writer, I have machinery that can return a task_group from viewsets
100%
Description
Right now all we can return for viewsets that dispatch tasks is a single task. This has two problems
- In cases where a viewset dispatches many tasks, the viewset can't hand back more than one task.
- In cases where a viewset dispatches a task group, we have no way of returning a reference to that task group.
Current machinery¶
The viewsets return an instance of OperationPostponedResponse
. For example, here is pulp_file's usage of it.
The openAPI schema part is handled by the viewset manually declaring the AsyncOperationResponseSerializer
as the return type. You can see that here in pulp_file for example.
Proposed machinery¶
Add a TaskGroupOperationPostponedResponse
which would be just like OperationPostponedResponse
except it would return a task_group
instead of task
.
Add a TaskGroupOperationResponseSerializer
which would be just like AsyncOperationResponseSerializer
only serialized for task_group
instead of task
.
Related issues
Adds machinery to return task groups from viewsets
Adds a
TaskGroupResponse
and correspondingTaskGroupResponseSerializer
allowing viewsets to return a task group back to users directly.closes #9380