Story #3542
closedAs a plugin writer, I can create a task that waits until there are no reservations
0%
Description
For orphan cleanup, we had to write a task that waits until there's no other reservations and then we execute it. We'd like to make this functionality more generic so that plugin writers can leverage it. Also, using the task's name to see if it's a zero reservation task is brittle.
Currently, we just hardcode the task name to see if it needs no reservations (see the design in #3442).
We need to come up with how the data model looks, the decorators for declaring these tasks, etc.
Related issues
Updated by daviddavis over 6 years ago
- Related to Story #3442: As a user, I can clean up both orphaned content units and orphaned artifacts added
Updated by bmbouter over 6 years ago
I think the crux of it is some way for the plugin writer to tell the resource manager to run the task code synchronously at the right time. To facilitate that, we could add a boolean parameter called singleton=False
to _queue_reserve_resource
. When True
instead of dispatching a task it performs the same call workflow as what the orphan cleanup code branches do.
Plugin writer's would need a way to call this easily. We could introduce a new call for them that would be attached onto all PulpTask
def apply_async_singleton(self, args=None, kwargs=None):
pass # do things similar to apply_async_with_reservation but call _queue_reserve_resource with singleton=True
This puts the caller in charge of saying what type of treatment that task needs.
Updated by bmbouter over 6 years ago
I also don't think this is something we need to fix right away or even soon. We don't have any plugin writer use cases with this type of requirement that I know of.
Updated by daviddavis about 4 years ago
- Status changed from NEW to CLOSED - CURRENTRELEASE
Updated by daviddavis about 4 years ago
- Status changed from CLOSED - CURRENTRELEASE to CLOSED - WONTFIX