Repository: ambari Updated Branches: refs/heads/trunk 791a24cda -> aa16f5ed8
AMBARI-19224. Perf: Host Checks response is way too big (320MB for 1200 nodes).(vbrodetskyi) Project: http://git-wip-us.apache.org/repos/asf/ambari/repo Commit: http://git-wip-us.apache.org/repos/asf/ambari/commit/aa16f5ed Tree: http://git-wip-us.apache.org/repos/asf/ambari/tree/aa16f5ed Diff: http://git-wip-us.apache.org/repos/asf/ambari/diff/aa16f5ed Branch: refs/heads/trunk Commit: aa16f5ed8836241e9187766b684c51ddcb5f0eeb Parents: 791a24c Author: Vitaly Brodetskyi <[email protected]> Authored: Fri Dec 16 15:38:37 2016 +0200 Committer: Vitaly Brodetskyi <[email protected]> Committed: Fri Dec 16 15:38:37 2016 +0200 ---------------------------------------------------------------------- .../src/main/resources/custom_actions/scripts/check_host.py | 8 ++++++-- .../src/test/python/custom_actions/TestCheckHost.py | 8 ++++++-- 2 files changed, 12 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/ambari/blob/aa16f5ed/ambari-server/src/main/resources/custom_actions/scripts/check_host.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/main/resources/custom_actions/scripts/check_host.py b/ambari-server/src/main/resources/custom_actions/scripts/check_host.py index 4077610..358c104 100644 --- a/ambari-server/src/main/resources/custom_actions/scripts/check_host.py +++ b/ambari-server/src/main/resources/custom_actions/scripts/check_host.py @@ -473,6 +473,7 @@ class CheckHost(Script): failedCount = 0 failures = [] + hosts_with_failures = [] if config['commandParams']['hosts'] is not None : hosts = config['commandParams']['hosts'].split(",") @@ -489,7 +490,9 @@ class CheckHost(Script): except socket.error,exception: successCount -= 1 failedCount += 1 - + + hosts_with_failures.append(host) + failure = { "host": host, "type": FORWARD_LOOKUP_REASON, "cause": exception.args } @@ -507,7 +510,8 @@ class CheckHost(Script): "message" : message, "failed_count" : failedCount, "success_count" : successCount, - "failures" : failures + "failures" : failures, + "hosts_with_failures" : hosts_with_failures } Logger.info("IP address forward resolution check completed.") http://git-wip-us.apache.org/repos/asf/ambari/blob/aa16f5ed/ambari-server/src/test/python/custom_actions/TestCheckHost.py ---------------------------------------------------------------------- diff --git a/ambari-server/src/test/python/custom_actions/TestCheckHost.py b/ambari-server/src/test/python/custom_actions/TestCheckHost.py index 0f28758..0d4e485 100644 --- a/ambari-server/src/test/python/custom_actions/TestCheckHost.py +++ b/ambari-server/src/test/python/custom_actions/TestCheckHost.py @@ -225,7 +225,8 @@ class TestCheckHost(TestCase): 'message': 'All hosts resolved to an IP address.', 'failed_count': 0, 'success_count': 5, - 'exit_code': 0}}) + 'exit_code': 0, + 'hosts_with_failures': []}}) # try it now with errors mock_socket.side_effect = socket.error @@ -239,7 +240,10 @@ class TestCheckHost(TestCase): {'cause': (), 'host': u'foobar', 'type': 'FORWARD_LOOKUP'}, {'cause': (), 'host': u'!!!', 'type': 'FORWARD_LOOKUP'}], 'message': 'There were 5 host(s) that could not resolve to an IP address.', - 'failed_count': 5, 'success_count': 0, 'exit_code': 0}}) + 'failed_count': 5, 'success_count': 0, 'exit_code': 0, 'hosts_with_failures': [u'c6401.ambari.apache.org', + u'c6402.ambari.apache.org', + u'c6403.ambari.apache.org', + u'foobar', u'!!!']}}) pass @patch.object(OSCheck, "os_distribution", new = MagicMock(return_value = os_distro_value))
