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-9913 Ambari Agent failed start blocks all future bootstrap attempts
Date Wed, 04 Mar 2015 01:55:11 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.0.0 66f8ecbef -> 6df638843


AMBARI-9913 Ambari Agent failed start blocks all future bootstrap attempts

Saving the PID only on successful start, after ensuring that the current instance is the only
one running locally.


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

Branch: refs/heads/branch-2.0.0
Commit: 6df6388430c4864b89646745e11d6ca3854bb074
Parents: 66f8ecb
Author: Florian Barca <fbarca@hortonworks.com>
Authored: Tue Mar 3 17:55:01 2015 -0800
Committer: Florian Barca <fbarca@hortonworks.com>
Committed: Tue Mar 3 17:55:01 2015 -0800

----------------------------------------------------------------------
 ambari-agent/src/main/python/ambari_agent/main.py            | 8 +++++---
 .../ambari-metrics-host-monitoring/src/main/python/main.py   | 4 ++--
 2 files changed, 7 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/6df63884/ambari-agent/src/main/python/ambari_agent/main.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/python/ambari_agent/main.py b/ambari-agent/src/main/python/ambari_agent/main.py
index 33c1bc8..ebf0781 100644
--- a/ambari-agent/src/main/python/ambari_agent/main.py
+++ b/ambari-agent/src/main/python/ambari_agent/main.py
@@ -233,11 +233,10 @@ def main(heartbeat_stop_callback=None):
 
   perform_prestart_checks(expected_hostname)
 
-  if not OSCheck.get_os_family() == OSConst.WINSRV_FAMILY:
-    daemonize()
-
   # Starting ping port listener
   try:
+    #This acts as a single process machine-wide lock (albeit incomplete, since
+    # we still need an extra file to track the Agent PID)
     ping_port_listener = PingPortListener(config)
   except Exception as ex:
     err_message = "Failed to start ping port listener of: " + str(ex)
@@ -251,6 +250,9 @@ def main(heartbeat_stop_callback=None):
   server_hostname = config.get('server', 'hostname')
   server_url = config.get_api_url()
 
+  if not OSCheck.get_os_family() == OSConst.WINSRV_FAMILY:
+    daemonize()
+
   try:
     server_ip = socket.gethostbyname(server_hostname)
     logger.info('Connecting to Ambari server at %s (%s)', server_url, server_ip)

http://git-wip-us.apache.org/repos/asf/ambari/blob/6df63884/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py
----------------------------------------------------------------------
diff --git a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py
index ce8ffc6..d218015 100644
--- a/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py
+++ b/ambari-metrics/ambari-metrics-host-monitoring/src/main/python/main.py
@@ -58,8 +58,6 @@ def server_process_main(stop_handler, scmStatus=None):
   if scmStatus is not None:
     scmStatus.reportStartPending()
 
-  save_pid(os.getpid(), PID_OUT_FILE)
-
   config = Configuration()
   _init_logging(config)
   controller = Controller(config, stop_handler)
@@ -70,6 +68,8 @@ def server_process_main(stop_handler, scmStatus=None):
   print "Server out at: " + SERVER_OUT_FILE
   print "Server log at: " + SERVER_LOG_FILE
 
+  save_pid(os.getpid(), PID_OUT_FILE)
+
   if scmStatus is not None:
     scmStatus.reportStarted()
 


Mime
View raw message