ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From fba...@apache.org
Subject ambari git commit: AMBARI-9542 Ams Service Check failed on 3-node cluster
Date Tue, 10 Feb 2015 17:35:49 GMT
Repository: ambari
Updated Branches:
  refs/heads/trunk 631d913da -> f5fe049eb


AMBARI-9542 Ams Service Check failed on 3-node cluster

Fixed HTTP ping retry loop


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

Branch: refs/heads/trunk
Commit: f5fe049eb7f078f34cada0258c441c9affa5a6d0
Parents: 631d913
Author: Florian Barca <fbarca@hortonworks.com>
Authored: Tue Feb 10 09:35:31 2015 -0800
Committer: Florian Barca <fbarca@hortonworks.com>
Committed: Tue Feb 10 09:35:31 2015 -0800

----------------------------------------------------------------------
 .../0.1.0/package/scripts/service_check.py            | 14 +++++++-------
 1 file changed, 7 insertions(+), 7 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/f5fe049e/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
----------------------------------------------------------------------
diff --git a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
index dc5a330..b5a5745 100644
--- a/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
+++ b/ambari-server/src/main/resources/common-services/AMBARI_METRICS/0.1.0/package/scripts/service_check.py
@@ -85,13 +85,13 @@ class AMSServiceCheck(Script):
         conn.request("POST", self.AMS_METRICS_POST_URL, metric_json, headers)
         break
       except (httplib.HTTPException, socket.error) as ex:
-        time.sleep(self.AMS_CONNECT_TIMEOUT)
-        Logger.info("Connection failed. Next retry in %s seconds."
-                    % (self.AMS_CONNECT_TIMEOUT))
-
-    if i == self.AMS_CONNECT_TRIES:
-      raise Fail("Metrics were not saved. Service check has failed. "
-           "\nConnection failed.")
+        if i < self.AMS_CONNECT_TRIES - 1:  #range/xrange returns items from start to
end-1
+          time.sleep(self.AMS_CONNECT_TIMEOUT)
+          Logger.info("Connection failed. Next retry in %s seconds."
+                      % (self.AMS_CONNECT_TIMEOUT))
+        else:
+          raise Fail("Metrics were not saved. Service check has failed. "
+               "\nConnection failed.")
 
     response = conn.getresponse()
     Logger.info("Http response: %s %s" % (response.status, response.reason))


Mime
View raw message