You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by fb...@apache.org on 2015/03/04 02:54:25 UTC
ambari git commit: AMBARI-9913 Ambari Agent failed start blocks all
future bootstrap attempts
Repository: ambari
Updated Branches:
refs/heads/trunk 63bf08e09 -> 99cc49b78
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/99cc49b7
Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/99cc49b7
Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/99cc49b7
Branch: refs/heads/trunk
Commit: 99cc49b784e0abeb754b20e0ea6d24ed7c6d6f3b
Parents: 63bf08e
Author: Florian Barca <fb...@hortonworks.com>
Authored: Tue Mar 3 17:54:11 2015 -0800
Committer: Florian Barca <fb...@hortonworks.com>
Committed: Tue Mar 3 17:54:11 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/99cc49b7/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/99cc49b7/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()