From 83550eeba06485ee7e3dedcbfec9c1da141cf120 Mon Sep 17 00:00:00 2001 From: Ryan Petrello Date: Thu, 31 Oct 2019 14:44:28 -0400 Subject: [PATCH] make the callback receiver more robust to duplicate UUIDs from ansible --- awx/main/dispatch/pool.py | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/awx/main/dispatch/pool.py b/awx/main/dispatch/pool.py index f5b92ca8f1..fc917a7f6d 100644 --- a/awx/main/dispatch/pool.py +++ b/awx/main/dispatch/pool.py @@ -123,8 +123,16 @@ class PoolWorker(object): # if any tasks were finished, removed them from the managed tasks for # this worker for uuid in finished: - self.messages_finished += 1 - del self.managed_tasks[uuid] + try: + del self.managed_tasks[uuid] + self.messages_finished += 1 + except KeyError: + # ansible _sometimes_ appears to send events w/ duplicate UUIDs; + # UUIDs for ansible events are *not* actually globally unique + # when this occurs, it's _fine_ to ignore this KeyError because + # the purpose of self.managed_tasks is to just track internal + # state of which events are *currently* being processed. + pass @property def current_task(self):