You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by dd...@apache.org on 2011/12/31 20:16:05 UTC
svn commit: r1226181 -
/incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py
Author: ddas
Date: Sat Dec 31 19:16:04 2011
New Revision: 1226181
URL: http://svn.apache.org/viewvc?rev=1226181&view=rev
Log:
AMBARI-180. Log enhancement to keep track of connection to the controller.
Modified:
incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py
Modified: incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py
URL: http://svn.apache.org/viewvc/incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py?rev=1226181&r1=1226180&r2=1226181&view=diff
==============================================================================
--- incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py (original)
+++ incubator/ambari/trunk/agent/src/main/python/ambari_agent/Controller.py Sat Dec 31 19:16:04 2011
@@ -55,7 +55,6 @@ class Controller(threading.Thread):
self.actionQueue = ActionQueue(self.config)
self.actionQueue.start()
self.heartbeat = Heartbeat(self.actionQueue)
- logger.info("Controller connection established.")
def __del__(self):
logger.info("Controller connection disconnected.")
@@ -71,6 +70,7 @@ class Controller(threading.Thread):
opener = urllib2.build_opener(auth_handler)
urllib2.install_opener(opener)
retry=False
+ firstTime=True
while True:
try:
if retry==False:
@@ -83,14 +83,16 @@ class Controller(threading.Thread):
data = json.loads(response)
id=int(data['responseId'])
self.actionQueue.put(data)
+ if retry==True or firstTime==True:
+ logger.info("Controller connection established")
+ firstTime=False
retry=False
except Exception, err:
retry=True
if "code" in err:
logger.error(err.code)
else:
- logger.error("Unable to connect to: "+self.url)
- traceback.print_exc()
+ logger.error("Unable to connect to: "+self.url,exc_info=True)
if self.actionQueue.isIdle():
time.sleep(30)
else: