You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ey...@apache.org on 2011/09/29 02:49:13 UTC

svn commit: r1177132 - in /incubator/ambari/trunk/agent/src/main/python/ambari_agent: ActionQueue.py Heartbeat.py

Author: eyang
Date: Thu Sep 29 00:49:12 2011
New Revision: 1177132

URL: http://svn.apache.org/viewvc?rev=1177132&view=rev
Log:
AMBARI-17. Added idle state check in agent heartbeat. (Eric Yang)

Modified:
    incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py
    incubator/ambari/trunk/agent/src/main/python/ambari_agent/Heartbeat.py

Modified: incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py?rev=1177132&r1=1177131&r2=1177132&view=diff
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py (original)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/ActionQueue.py Thu Sep 29 00:49:12 2011
@@ -123,3 +123,7 @@ class ActionQueue(threading.Thread):
     logger.error('Unknown action: %s' % action['id'])
     result = { 'id': action['id'] }
     return result
+
+  # Discover agent idle state
+  def isIdle(self):
+    return q.empty()

Modified: incubator/ambari/trunk/agent/src/main/python/ambari_agent/Heartbeat.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/Heartbeat.py?rev=1177132&r1=1177131&r2=1177132&view=diff
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_agent/Heartbeat.py (original)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/Heartbeat.py Thu Sep 29 00:49:12 2011
@@ -40,7 +40,8 @@ class Heartbeat:
                   'hostname' : socket.gethostname(),
                   'hardwareProfile' : hardware.get(),
                   'actionResults' : self.actionQueue.result(),
-                  'serversStatus' : serverStatus.build()
+                  'serversStatus' : serverStatus.build(),
+                  'idle' : self.actionQueue.isIdle()
                 }
     return heartbeat