AMBARI-19201. Log size of status command queue size on Ambari agent 
(magyari_sandor)


Project: http://git-wip-us.apache.org/repos/asf/ambari/repo
Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/fd1ff56a
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/fd1ff56a
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/fd1ff56a

Branch: refs/heads/branch-dev-patch-upgrade
Commit: fd1ff56afba1cb84367947c7440371464ff594a5
Parents: 44e6072
Author: Sandor Magyari <[email protected]>
Authored: Thu Dec 15 14:25:29 2016 +0100
Committer: Sandor Magyari <[email protected]>
Committed: Fri Dec 16 21:42:35 2016 +0100

----------------------------------------------------------------------
 ambari-agent/src/main/python/ambari_agent/ActionQueue.py | 10 +++++++---
 1 file changed, 7 insertions(+), 3 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/fd1ff56a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py 
b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
index cb4fcb9..cc1a048 100644
--- a/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
+++ b/ambari-agent/src/main/python/ambari_agent/ActionQueue.py
@@ -97,9 +97,13 @@ class ActionQueue(threading.Thread):
     return self._stop.isSet()
 
   def put_status(self, commands):
-    #Clear all status commands. Was supposed that we got all set of statuses, 
we don't need to keep old ones
-    while not self.statusCommandQueue.empty():
-      self.statusCommandQueue.get()
+    if not self.statusCommandQueue.empty():
+      #Clear all status commands. Was supposed that we got all set of 
statuses, we don't need to keep old ones
+      statusCommandQueueSize = 0
+      while not self.statusCommandQueue.empty():
+        self.statusCommandQueue.get()
+        statusCommandQueueSize = statusCommandQueueSize + 1
+      logger.info("Number of status commands removed from queue : " + 
str(statusCommandQueueSize))
 
     for command in commands:
       logger.info("Adding " + command['commandType'] + " for component " + \

Reply via email to