Repository: ambari Updated Branches: refs/heads/branch-3.0-perf 24464d9b4 -> a5d85a899
AMBARI-21899. Component status reports are sent for the components which are not on the host (aonishuk) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/a5d85a89 Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/a5d85a89 Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/a5d85a89 Branch: refs/heads/branch-3.0-perf Commit: a5d85a89949f127d0d3906224aa410c075e0b738 Parents: 24464d9 Author: Andrew Onishuk <[email protected]> Authored: Thu Sep 7 12:51:55 2017 +0300 Committer: Andrew Onishuk <[email protected]> Committed: Thu Sep 7 12:51:55 2017 +0300 ---------------------------------------------------------------------- .../src/main/python/ambari_agent/ClusterTopologyCache.py | 6 ++++++ .../src/main/python/ambari_agent/ComponentStatusExecutor.py | 9 +++++++++ 2 files changed, 15 insertions(+) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/a5d85a89/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py b/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py index e35b219..af11cc5 100644 --- a/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py +++ b/ambari-agent/src/main/python/ambari_agent/ClusterTopologyCache.py @@ -113,6 +113,12 @@ class ClusterTopologyCache(ClusterCache): current_host_id = self.current_host_ids_to_cluster[cluster_id] return self.get_host_info_by_id(cluster_id, current_host_id) + def get_current_host_id(self, cluster_id): + try: + return self.current_host_ids_to_cluster[cluster_id] + except KeyError: + return None + @staticmethod def _find_host_by_id_in_dict(host_dicts, host_id): for host_dict in host_dicts: http://git-wip-us.apache.org/repos/asf/ambari/blob/a5d85a89/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py ---------------------------------------------------------------------- diff --git a/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py b/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py index 4ccd815..d074786c 100644 --- a/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py +++ b/ambari-agent/src/main/python/ambari_agent/ComponentStatusExecutor.py @@ -65,6 +65,11 @@ class ComponentStatusExecutor(threading.Thread): if not 'components' in topology_cache: continue + current_host_id = self.topology_cache.get_current_host_id(cluster_id) + + if current_host_id is None: + continue + cluster_components = topology_cache.components for component_dict in cluster_components: for command_name in status_commands_to_run: @@ -76,6 +81,10 @@ class ComponentStatusExecutor(threading.Thread): if not cluster_id in self.topology_cache.get_cluster_ids(): break + # check if component is installed on current host + if not current_host_id in component_dict.hostIds: + break + service_name = component_dict.serviceName component_name = component_dict.componentName
