As a plugin writer, I can create a task that waits until there are no reservations
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.
#3 Updated by bmbouter almost 2 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
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
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.
Please register to edit this issue