Refactor Merger/Executor API

The Merger and executor APIs have a lot in common, but they behave
slightly differently.  A merger needs to sometimes return results.
An executor needs to have separate queues for zones and be able to
pause or cancel jobs.

This refactors them both into a common class which can handle job
state changes (like pause/cancel) and return results if requested.

The MergerApi can subclass this fairly trivially.

The ExecutorApi adds an intermediate layer which uses a
DefaultKeyDict to maintain a distinct queue for every zone and then
transparently dispatches method calls to the queue object for
that zone.

The ZK paths for both are significantly altered in this change.

Change-Id: I3adedcc4ea293e43070ba6ef0fe29e7889a0b502
This commit is contained in:
James E. Blair
2021-08-04 16:40:14 -07:00
parent 8038f9f75c
commit a729d6c6e8
14 changed files with 941 additions and 1247 deletions

View File

@@ -441,9 +441,9 @@ class EventResultFuture(ZooKeeperSimpleBase):
return True
class MergerEventResultFuture(EventResultFuture):
class JobResultFuture(EventResultFuture):
log = logging.getLogger("zuul.zk.event_queues.ManagementEventResultFuture")
log = logging.getLogger("zuul.JobResultFuture")
def __init__(self, client, result_path, waiter_path):
super().__init__(client, result_path)