You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@ambari.apache.org by ao...@apache.org on 2018/01/24 11:33:28 UTC

[ambari] branch branch-3.0-perf updated (30b6f5b -> c066c97)

This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a change to branch branch-3.0-perf
in repository https://gitbox.apache.org/repos/asf/ambari.git.


    from 30b6f5b  AMBARI-22753. Fix existing unit tests after STOMP protocol implementation. (mpapirkovskyy)
     new 118591c  AMBARI-22784. Fix stack unit tests on branch-3.0-perf (aonishuk)
     new 256578b  AMBARI-22784. Fix stack unit tests on branch-3.0-perf (aonishuk)
     new c066c97  AMBARI-22838. Fix TestRecoveryManager ClusterConfigurationCache and a bunch of small tests (aonishuk)

The 3 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../ambari_agent/TestClusterConfigurationCache.py  |  32 +--
 .../src/test/python/ambari_agent/TestFileCache.py  |   6 +-
 .../python/ambari_agent/TestRecoveryManager.py     | 265 ++++-----------------
 .../test/python/resource_management/TestScript.py  |  15 +-
 4 files changed, 67 insertions(+), 251 deletions(-)

-- 
To stop receiving notification emails like this one, please contact
aonishuk@apache.org.

[ambari] 02/03: AMBARI-22784. Fix stack unit tests on branch-3.0-perf (aonishuk)

Posted by ao...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch branch-3.0-perf
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 256578bf1a9d73dd1dbd0df0332bce5264246264
Author: Andrew Onishuk <ao...@hortonworks.com>
AuthorDate: Mon Jan 15 15:36:26 2018 +0200

    AMBARI-22784. Fix stack unit tests on branch-3.0-perf (aonishuk)
---
 .../src/main/python/ambari_stomp/adapter/websocket.py |  9 +--------
 .../src/main/python/ambari_stomp/transport.py         | 19 ++-----------------
 2 files changed, 3 insertions(+), 25 deletions(-)

diff --git a/ambari-common/src/main/python/ambari_stomp/adapter/websocket.py b/ambari-common/src/main/python/ambari_stomp/adapter/websocket.py
index 421fd88..6cf19db 100644
--- a/ambari-common/src/main/python/ambari_stomp/adapter/websocket.py
+++ b/ambari-common/src/main/python/ambari_stomp/adapter/websocket.py
@@ -54,16 +54,13 @@ class QueuedWebSocketClient(WebSocketClient):
     # left in the queue, return None immediately otherwise the client
     # will block forever
     if self.terminated and self.messages.empty():
-      logger.info("!!! RETURNING NONE")
       return None
     message = self.messages.get()
     if message is StopIteration:
-      logger.info("!!! RETURNING NONE DUE TO STOP_ITERATION")
       return None
     return message
 
   def closed(self, code, reason=None):
-    logger.info("!!!CLOSED IS CALLED {0} {1}", code, reason)
     self.messages.put(StopIteration)
 
 class WsTransport(Transport):
@@ -94,7 +91,6 @@ class WsTransport(Transport):
   def send(self, encoded_frame):
     logger.debug("Outgoing STOMP message:\n>>> " + encoded_frame)
     if self.ws.terminated:
-      logger.info("!!!SEND ERROR")
       raise ConnectionIsAlreadyClosed("Connection is already closed cannot send data")
 
     self.ws.send(encoded_frame)
@@ -103,8 +99,7 @@ class WsTransport(Transport):
     try:
       msg = self.ws.receive()
       msg = str(msg) if msg is not None else msg
-      if not msg:
-        logger.info("Incoming STOMP message:\n<<< {0}".format(msg))
+      logger.debug("Incoming STOMP message:\n<<< {0}".format(msg))
       return msg
     except:
       # exceptions from this method are hidden by the framework so implementing logging by ourselves
@@ -112,7 +107,6 @@ class WsTransport(Transport):
     return None
 
   def stop(self):
-    logger.info("!!!WsTransport.stop()")
     self.running = False
     try:
       self.ws.terminate()
@@ -137,7 +131,6 @@ class WsConnection(BaseConnection, Protocol12):
     Protocol12.__init__(self, self.transport, (0, 0))
 
   def disconnect(self, receipt=None, headers=None, **keyword_headers):
-    logger.info("!!!WsConnection.disconnect()")
     try:
       Protocol12.disconnect(self, receipt, headers, **keyword_headers)
     except:
diff --git a/ambari-common/src/main/python/ambari_stomp/transport.py b/ambari-common/src/main/python/ambari_stomp/transport.py
index 8d85dcc..32604fc 100644
--- a/ambari-common/src/main/python/ambari_stomp/transport.py
+++ b/ambari-common/src/main/python/ambari_stomp/transport.py
@@ -326,7 +326,6 @@ class BaseTransport(ambari_stomp.listener.Publisher):
         """
         Main loop listening for incoming data.
         """
-        
         log.info("Starting receiver loop")
         try:
             while self.running:
@@ -341,12 +340,8 @@ class BaseTransport(ambari_stomp.listener.Publisher):
                             if self.__auto_decode:
                                 f.body = decode(f.body)
                             self.process_frame(f, frame)
-                            
-                    log.info("!!NOT RUNNING")
                 except exception.ConnectionClosedException:
-                    log.exception("!!except exception.ConnectionClosedException:")
                     if self.running:
-                        log.info("!!except exception.ConnectionClosedException if self.running")
                         self.notify('disconnected')
                         #
                         # Clear out any half-received messages after losing connection
@@ -354,16 +349,8 @@ class BaseTransport(ambari_stomp.listener.Publisher):
                         self.__recvbuf = b''
                         self.running = False
                     break
-                except:
-                    log.exception("!!!EXCEPTION at loop")
-                    raise
                 finally:
-                    log.info("!!!CLEANUP")
                     self.cleanup()
-            log.info("!!NOT RUNNING BIG LOOP")
-        except:
-          log.exception("!!!EXCEPTION at big loop")
-          raise
         finally:
             with self.__receiver_thread_exit_condition:
                 self.__receiver_thread_exited = True
@@ -383,13 +370,12 @@ class BaseTransport(ambari_stomp.listener.Publisher):
                 try:
                     c = self.receive()
                 except exception.InterruptedException:
-                    log.info("!!!socket read interrupted, restarting")
+                    log.debug("socket read interrupted, restarting")
                     continue
             except Exception:
-                log.info("!!!socket read error", exc_info=True)
+                log.debug("socket read error", exc_info=True)
                 c = b''
             if c is None or len(c) == 0:
-                log.error("!!ConnectionClosedException!!! {0}".format(c))
                 raise exception.ConnectionClosedException()
             if c == b'\x0a' and not self.__recvbuf and not fastbuf.tell():
                 #
@@ -590,7 +576,6 @@ class Transport(BaseTransport):
         """
         Disconnect the underlying socket connection
         """
-        log.info("!!!disconnect_socket")
         self.running = False
         if self.socket is not None:
             if self.__need_ssl():

-- 
To stop receiving notification emails like this one, please contact
aonishuk@apache.org.

[ambari] 01/03: AMBARI-22784. Fix stack unit tests on branch-3.0-perf (aonishuk)

Posted by ao...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch branch-3.0-perf
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit 118591cd046fb51ae81953ddfeb99b8696b4cb0a
Author: Andrew Onishuk <ao...@hortonworks.com>
AuthorDate: Mon Jan 15 15:30:47 2018 +0200

    AMBARI-22784. Fix stack unit tests on branch-3.0-perf (aonishuk)
---
 .../src/main/python/ambari_stomp/adapter/websocket.py |  9 ++++++++-
 .../src/main/python/ambari_stomp/transport.py         | 19 +++++++++++++++++--
 2 files changed, 25 insertions(+), 3 deletions(-)

diff --git a/ambari-common/src/main/python/ambari_stomp/adapter/websocket.py b/ambari-common/src/main/python/ambari_stomp/adapter/websocket.py
index 6cf19db..421fd88 100644
--- a/ambari-common/src/main/python/ambari_stomp/adapter/websocket.py
+++ b/ambari-common/src/main/python/ambari_stomp/adapter/websocket.py
@@ -54,13 +54,16 @@ class QueuedWebSocketClient(WebSocketClient):
     # left in the queue, return None immediately otherwise the client
     # will block forever
     if self.terminated and self.messages.empty():
+      logger.info("!!! RETURNING NONE")
       return None
     message = self.messages.get()
     if message is StopIteration:
+      logger.info("!!! RETURNING NONE DUE TO STOP_ITERATION")
       return None
     return message
 
   def closed(self, code, reason=None):
+    logger.info("!!!CLOSED IS CALLED {0} {1}", code, reason)
     self.messages.put(StopIteration)
 
 class WsTransport(Transport):
@@ -91,6 +94,7 @@ class WsTransport(Transport):
   def send(self, encoded_frame):
     logger.debug("Outgoing STOMP message:\n>>> " + encoded_frame)
     if self.ws.terminated:
+      logger.info("!!!SEND ERROR")
       raise ConnectionIsAlreadyClosed("Connection is already closed cannot send data")
 
     self.ws.send(encoded_frame)
@@ -99,7 +103,8 @@ class WsTransport(Transport):
     try:
       msg = self.ws.receive()
       msg = str(msg) if msg is not None else msg
-      logger.debug("Incoming STOMP message:\n<<< {0}".format(msg))
+      if not msg:
+        logger.info("Incoming STOMP message:\n<<< {0}".format(msg))
       return msg
     except:
       # exceptions from this method are hidden by the framework so implementing logging by ourselves
@@ -107,6 +112,7 @@ class WsTransport(Transport):
     return None
 
   def stop(self):
+    logger.info("!!!WsTransport.stop()")
     self.running = False
     try:
       self.ws.terminate()
@@ -131,6 +137,7 @@ class WsConnection(BaseConnection, Protocol12):
     Protocol12.__init__(self, self.transport, (0, 0))
 
   def disconnect(self, receipt=None, headers=None, **keyword_headers):
+    logger.info("!!!WsConnection.disconnect()")
     try:
       Protocol12.disconnect(self, receipt, headers, **keyword_headers)
     except:
diff --git a/ambari-common/src/main/python/ambari_stomp/transport.py b/ambari-common/src/main/python/ambari_stomp/transport.py
index 32604fc..8d85dcc 100644
--- a/ambari-common/src/main/python/ambari_stomp/transport.py
+++ b/ambari-common/src/main/python/ambari_stomp/transport.py
@@ -326,6 +326,7 @@ class BaseTransport(ambari_stomp.listener.Publisher):
         """
         Main loop listening for incoming data.
         """
+        
         log.info("Starting receiver loop")
         try:
             while self.running:
@@ -340,8 +341,12 @@ class BaseTransport(ambari_stomp.listener.Publisher):
                             if self.__auto_decode:
                                 f.body = decode(f.body)
                             self.process_frame(f, frame)
+                            
+                    log.info("!!NOT RUNNING")
                 except exception.ConnectionClosedException:
+                    log.exception("!!except exception.ConnectionClosedException:")
                     if self.running:
+                        log.info("!!except exception.ConnectionClosedException if self.running")
                         self.notify('disconnected')
                         #
                         # Clear out any half-received messages after losing connection
@@ -349,8 +354,16 @@ class BaseTransport(ambari_stomp.listener.Publisher):
                         self.__recvbuf = b''
                         self.running = False
                     break
+                except:
+                    log.exception("!!!EXCEPTION at loop")
+                    raise
                 finally:
+                    log.info("!!!CLEANUP")
                     self.cleanup()
+            log.info("!!NOT RUNNING BIG LOOP")
+        except:
+          log.exception("!!!EXCEPTION at big loop")
+          raise
         finally:
             with self.__receiver_thread_exit_condition:
                 self.__receiver_thread_exited = True
@@ -370,12 +383,13 @@ class BaseTransport(ambari_stomp.listener.Publisher):
                 try:
                     c = self.receive()
                 except exception.InterruptedException:
-                    log.debug("socket read interrupted, restarting")
+                    log.info("!!!socket read interrupted, restarting")
                     continue
             except Exception:
-                log.debug("socket read error", exc_info=True)
+                log.info("!!!socket read error", exc_info=True)
                 c = b''
             if c is None or len(c) == 0:
+                log.error("!!ConnectionClosedException!!! {0}".format(c))
                 raise exception.ConnectionClosedException()
             if c == b'\x0a' and not self.__recvbuf and not fastbuf.tell():
                 #
@@ -576,6 +590,7 @@ class Transport(BaseTransport):
         """
         Disconnect the underlying socket connection
         """
+        log.info("!!!disconnect_socket")
         self.running = False
         if self.socket is not None:
             if self.__need_ssl():

-- 
To stop receiving notification emails like this one, please contact
aonishuk@apache.org.

[ambari] 03/03: AMBARI-22838. Fix TestRecoveryManager ClusterConfigurationCache and a bunch of small tests (aonishuk)

Posted by ao...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

aonishuk pushed a commit to branch branch-3.0-perf
in repository https://gitbox.apache.org/repos/asf/ambari.git

commit c066c972c622070f643a387bd467f75676e1732a
Author: Andrew Onishuk <ao...@hortonworks.com>
AuthorDate: Wed Jan 24 13:29:25 2018 +0200

    AMBARI-22838. Fix TestRecoveryManager ClusterConfigurationCache and a bunch of small tests (aonishuk)
---
 .../ambari_agent/TestClusterConfigurationCache.py  |  32 +--
 .../src/test/python/ambari_agent/TestFileCache.py  |   6 +-
 .../python/ambari_agent/TestRecoveryManager.py     | 265 ++++-----------------
 .../test/python/resource_management/TestScript.py  |  15 +-
 4 files changed, 67 insertions(+), 251 deletions(-)

diff --git a/ambari-agent/src/test/python/ambari_agent/TestClusterConfigurationCache.py b/ambari-agent/src/test/python/ambari_agent/TestClusterConfigurationCache.py
index f7159d9..73f24c1 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestClusterConfigurationCache.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestClusterConfigurationCache.py
@@ -39,24 +39,18 @@ class TestClusterConfigurationCache(TestCase):
     sys.stdout == sys.__stdout__
 
 
+  @patch("json.load")
   @patch("os.path.exists", new = MagicMock(return_value=True))
   @patch("os.path.isfile", new = MagicMock(return_value=True))
-  def test_cluster_configuration_cache_initialization(self):
-    configuration_json = '{ "c1" : { "foo-site" : { "foo" : "bar", "foobar" : "baz" } } }'
-    open_mock = mock_open(read_data=configuration_json)
+  def test_cluster_configuration_cache_initialization(self, json_load_mock):
+    configuration_json = { "0" : { "foo-site" : { "foo" : "bar", "foobar" : "baz" } } }
+    
+    json_load_mock.return_value = configuration_json
+    cluster_configuration = ClusterConfigurationCache(os.path.join(os.sep, "tmp", "bar", "baz"))
+    cluster_configuration.rewrite_cache(configuration_json, 'abc')
 
-    with patch("__builtin__.open", open_mock):
-      cluster_configuration = ClusterConfigurationCache(os.path.join(os.sep, "tmp", "bar", "baz"))
-
-    open_mock.assert_called_with(os.sep + "tmp" + os.sep + "bar" + os.sep + "baz" + os.sep + "configurations.json", 'r')
-
-    self.assertEqual('bar', cluster_configuration.get_configuration_value('c1', 'foo-site/foo') )
-    self.assertEqual('baz', cluster_configuration.get_configuration_value('c1', 'foo-site/foobar') )
-    self.assertEqual(None, cluster_configuration.get_configuration_value('c1', 'INVALID') )
-    self.assertEqual(None, cluster_configuration.get_configuration_value('c1', 'INVALID/INVALID') )
-    self.assertEqual(None, cluster_configuration.get_configuration_value('INVALID', 'foo-site/foo') )
-    self.assertEqual(None, cluster_configuration.get_configuration_value('INVALID', 'foo-site/foobar') )
-    pass
+    self.assertEqual('bar', cluster_configuration['0']['foo-site']['foo'] )
+    self.assertEqual('baz', cluster_configuration['0']['foo-site']['foobar'] )
 
 
   @patch("ambari_simplejson.dump")
@@ -68,12 +62,8 @@ class TestClusterConfigurationCache(TestCase):
     }
 
     osopen_mock, osfdopen_mock = self.__update_cluster_configuration(cluster_configuration, configuration)
-    osopen_mock.assert_called_with(os.sep + "tmp" + os.sep + "bar" + os.sep + "baz" + os.sep + "configurations.json",
-                                   TestClusterConfigurationCache.o_flags,
-                                   TestClusterConfigurationCache.perms);
-    osfdopen_mock.assert_called_with(11, "w")
 
-    json_dump_mock.assert_called_with({'c1': {'foo-site': {'baz': 'rendered-baz', 'bar': 'rendered-bar'}}}, ANY, indent=2)
+    json_dump_mock.assert_called_with({'0': {'foo-site': {'baz': 'rendered-baz', 'bar': 'rendered-bar'}}}, ANY, indent=2)
     pass
 
   def __get_cluster_configuration(self):
@@ -97,7 +87,7 @@ class TestClusterConfigurationCache(TestCase):
     :return:
     """
     osopen_mock.return_value = 11
-    cluster_configuration.update_cache("c1", configuration)
+    cluster_configuration.rewrite_cache({"0":configuration},'test-hash')
 
     return osopen_mock, osfdopen_mock
 
diff --git a/ambari-agent/src/test/python/ambari_agent/TestFileCache.py b/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
index 68cc8d9..31fe4b6 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestFileCache.py
@@ -65,7 +65,7 @@ class TestFileCache(TestCase):
     provide_directory_mock.return_value = "dummy value"
     fileCache = FileCache(self.config)
     command = {
-      'commandParams' : {
+      'serviceLevelParams' : {
         'service_package_folder' : os.path.join('stacks', 'HDP', '2.1.1', 'services', 'ZOOKEEPER', 'package')
       }
     }
@@ -83,7 +83,7 @@ class TestFileCache(TestCase):
     fileCache = FileCache(self.config)
     # Check missing parameter
     command = {
-      'commandParams' : {
+      'clusterLevelParams' : {
       }
     }
     base = fileCache.get_hook_base_dir(command, "server_url_pref")
@@ -92,7 +92,7 @@ class TestFileCache(TestCase):
 
     # Check existing dir case
     command = {
-      'commandParams' : {
+      'clusterLevelParams' : {
         'hooks_folder' : 'stack-hooks'
       }
     }
diff --git a/ambari-agent/src/test/python/ambari_agent/TestRecoveryManager.py b/ambari-agent/src/test/python/ambari_agent/TestRecoveryManager.py
index 7963a17..b9800bb 100644
--- a/ambari-agent/src/test/python/ambari_agent/TestRecoveryManager.py
+++ b/ambari-agent/src/test/python/ambari_agent/TestRecoveryManager.py
@@ -122,38 +122,6 @@ class _TestRecoveryManager(TestCase):
   def tearDown(self):
     pass
 
-  @patch.object(RecoveryManager, "update_desired_status")
-  def test_process_commands(self, mock_uds):
-    rm = RecoveryManager(tempfile.mktemp(), True)
-    rm.process_status_commands(None)
-    self.assertFalse(mock_uds.called)
-
-    rm.process_status_commands([])
-    self.assertFalse(mock_uds.called)
-
-    rm.process_status_commands([self.command])
-    mock_uds.assert_has_calls([call("NODEMANAGER", "STARTED")])
-
-    mock_uds.reset_mock()
-
-    rm.process_status_commands([self.command, self.exec_command1, self.command])
-    mock_uds.assert_has_calls([call("NODEMANAGER", "STARTED")], [call("NODEMANAGER", "STARTED")])
-
-    mock_uds.reset_mock()
-
-    rm.update_config(12, 5, 1, 15, True, False, False, "NODEMANAGER", -1)
-    rm.process_execution_commands([self.exec_command1, self.exec_command2, self.exec_command3])
-    mock_uds.assert_has_calls([call("NODEMANAGER", "INSTALLED")], [call("NODEMANAGER", "STARTED")])
-
-    mock_uds.reset_mock()
-
-    rm.process_execution_commands([self.exec_command1, self.command])
-    mock_uds.assert_has_calls([call("NODEMANAGER", "INSTALLED")])
-
-    rm.process_execution_commands([self.exec_command4])
-    mock_uds.assert_has_calls([call("NODEMANAGER", "STARTED")])
-    pass
-
   def test_defaults(self):
     rm = RecoveryManager(tempfile.mktemp())
     self.assertFalse(rm.enabled())
@@ -174,29 +142,29 @@ class _TestRecoveryManager(TestCase):
     rm = RecoveryManager(tempfile.mktemp(), True, False)
     self.assertTrue(rm.enabled())
 
-    config = rm.update_config(0, 60, 5, 12, True, False, False, "", -1)
+    config = rm.update_config(0, 60, 5, 12, True, False, False, "")
     self.assertFalse(rm.enabled())
 
-    rm.update_config(6, 60, 5, 12, True, False, False, "", -1)
+    rm.update_config(6, 60, 5, 12, True, False, False, "")
     self.assertTrue(rm.enabled())
 
-    rm.update_config(6, 0, 5, 12, True, False, False, "", -1)
+    rm.update_config(6, 0, 5, 12, True, False, False, "")
     self.assertFalse(rm.enabled())
 
-    rm.update_config(6, 60, 0, 12, True, False, False, "", -1)
+    rm.update_config(6, 60, 0, 12, True, False, False, "")
     self.assertFalse(rm.enabled())
 
-    rm.update_config(6, 60, 1, 12, True, False, False, None, -1)
+    rm.update_config(6, 60, 1, 12, True, False, False, None)
     self.assertTrue(rm.enabled())
 
-    rm.update_config(6, 60, 61, 12, True, False, False, None, -1)
+    rm.update_config(6, 60, 61, 12, True, False, False, None)
     self.assertFalse(rm.enabled())
 
-    rm.update_config(6, 60, 5, 4, True, False, False, "", -1)
+    rm.update_config(6, 60, 5, 4, True, False, False, "")
     self.assertFalse(rm.enabled())
 
     # maximum 2 in 2 minutes and at least 1 minute wait
-    rm.update_config(2, 5, 1, 4, True, False, False, "", -1)
+    rm.update_config(2, 5, 1, 4, True, False, False, "")
     self.assertTrue(rm.enabled())
 
     # T = 1000-2
@@ -222,7 +190,7 @@ class _TestRecoveryManager(TestCase):
     self.assertFalse(rm.may_execute("NODEMANAGER"))  # too soon
 
     # maximum 2 in 2 minutes and no min wait
-    rm.update_config(2, 5, 1, 5, True, True, False, "", -1)
+    rm.update_config(2, 5, 1, 5, True, True, False, "")
 
     # T = 1500-3
     self.assertTrue(rm.execute("NODEMANAGER2"))
@@ -242,7 +210,7 @@ class _TestRecoveryManager(TestCase):
 
   def test_recovery_required(self):
     rm = RecoveryManager(tempfile.mktemp(), True, False)
-    rm.update_config(12, 5, 1, 15, True, False, False, "NODEMANAGER", -1)
+    rm.update_config(12, 5, 1, 15, True, False, False, "NODEMANAGER")
     rm.update_current_status("NODEMANAGER", "INSTALLED")
     rm.update_desired_status("NODEMANAGER", "INSTALLED")
     self.assertFalse(rm.requires_recovery("NODEMANAGER"))
@@ -290,13 +258,13 @@ class _TestRecoveryManager(TestCase):
   def test_recovery_required2(self):
 
     rm = RecoveryManager(tempfile.mktemp(), True, True)
-    rm.update_config(15, 5, 1, 16, True, False, False, "NODEMANAGER", -1)
+    rm.update_config(15, 5, 1, 16, True, False, False, "NODEMANAGER")
     rm.update_current_status("NODEMANAGER", "INSTALLED")
     rm.update_desired_status("NODEMANAGER", "STARTED")
     self.assertTrue(rm.requires_recovery("NODEMANAGER"))
 
     rm = RecoveryManager(tempfile.mktemp(), True, True)
-    rm.update_config(15, 5, 1, 16, True, False, False, "NODEMANAGER", -1)
+    rm.update_config(15, 5, 1, 16, True, False, False, "NODEMANAGER")
     rm.update_current_status("NODEMANAGER", "INSTALLED")
     rm.update_desired_status("NODEMANAGER", "STARTED")
     self.assertTrue(rm.requires_recovery("NODEMANAGER"))
@@ -306,7 +274,7 @@ class _TestRecoveryManager(TestCase):
     self.assertFalse(rm.requires_recovery("DATANODE"))
 
     rm = RecoveryManager(tempfile.mktemp(), True, True)
-    rm.update_config(15, 5, 1, 16, True, False, False, "", -1)
+    rm.update_config(15, 5, 1, 16, True, False, False, "")
     rm.update_current_status("NODEMANAGER", "INSTALLED")
     rm.update_desired_status("NODEMANAGER", "STARTED")
     self.assertFalse(rm.requires_recovery("NODEMANAGER"))
@@ -315,7 +283,7 @@ class _TestRecoveryManager(TestCase):
     rm.update_desired_status("DATANODE", "STARTED")
     self.assertFalse(rm.requires_recovery("DATANODE"))
 
-    rm.update_config(15, 5, 1, 16, True, False, False, "NODEMANAGER", -1)
+    rm.update_config(15, 5, 1, 16, True, False, False, "NODEMANAGER")
     rm.update_current_status("NODEMANAGER", "INSTALLED")
     rm.update_desired_status("NODEMANAGER", "STARTED")
     self.assertTrue(rm.requires_recovery("NODEMANAGER"))
@@ -325,186 +293,48 @@ class _TestRecoveryManager(TestCase):
     self.assertFalse(rm.requires_recovery("DATANODE"))
     pass
 
-  @patch('time.time', MagicMock(side_effects=[1]))
-  def test_store_from_status_and_use(self):
-    rm = RecoveryManager(tempfile.mktemp(), True)
-
-    command1 = copy.deepcopy(self.command)
-
-    rm.store_or_update_command(command1)
-    self.assertTrue(rm.command_exists("NODEMANAGER", "EXECUTION_COMMAND"))
-
-    install_command = rm.get_install_command("NODEMANAGER")
-    start_command = rm.get_start_command("NODEMANAGER")
-
-    self.assertEqual("INSTALL", install_command["roleCommand"])
-    self.assertEqual("START", start_command["roleCommand"])
-    self.assertEqual("AUTO_EXECUTION_COMMAND", install_command["commandType"])
-    self.assertEqual("AUTO_EXECUTION_COMMAND", start_command["commandType"])
-    self.assertEqual("NODEMANAGER", install_command["role"])
-    self.assertEqual("NODEMANAGER", start_command["role"])
-    self.assertEquals(install_command["configurations"], start_command["configurations"])
-
-    self.assertEqual(2, install_command["taskId"])
-    self.assertEqual(3, start_command["taskId"])
-
-    self.assertEqual(None, rm.get_install_command("component2"))
-    self.assertEqual(None, rm.get_start_command("component2"))
-
-    self.assertTrue(rm.remove_command("NODEMANAGER"))
-    self.assertFalse(rm.remove_command("NODEMANAGER"))
-
-    self.assertEqual(None, rm.get_install_command("NODEMANAGER"))
-    self.assertEqual(None, rm.get_start_command("NODEMANAGER"))
-
-    self.assertEqual(None, rm.get_install_command("component2"))
-    self.assertEqual(None, rm.get_start_command("component2"))
-
-    rm.store_or_update_command(command1)
-    self.assertTrue(rm.command_exists("NODEMANAGER", "EXECUTION_COMMAND"))
-    rm.set_paused(True)
-
-    self.assertEqual(None, rm.get_install_command("NODEMANAGER"))
-    self.assertEqual(None, rm.get_start_command("NODEMANAGER"))
-
-    pass
-
-  @patch.object(RecoveryManager, "_now_")
-  def test_get_recovery_commands(self, time_mock):
-    time_mock.side_effect = \
-      [1000, 1001, 1002, 1003,
-       1100, 1101, 1102,
-       1200, 1201, 1203,
-       4000, 4001, 4002, 4003,
-       4100, 4101, 4102, 4103,
-       4200, 4201, 4202,
-       4300, 4301, 4302, 4399,
-       4400, 4401, 4402,]
-    rm = RecoveryManager(tempfile.mktemp(), True)
-    rm.update_config(15, 5, 1, 16, True, False, False, "", -1)
-
-    command1 = copy.deepcopy(self.command)
-
-    rm.store_or_update_command(command1)
-    rm.update_config(12, 5, 1, 15, True, False, False, "NODEMANAGER", -1)
-    rm.update_current_status("NODEMANAGER", "INSTALLED")
-    rm.update_desired_status("NODEMANAGER", "STARTED")
-    self.assertEqual("INSTALLED", rm.get_current_status("NODEMANAGER"))
-    self.assertEqual("STARTED", rm.get_desired_status("NODEMANAGER"))
-
-    commands = rm.get_recovery_commands()
-    self.assertEqual(1, len(commands))
-    self.assertEqual("START", commands[0]["roleCommand"])
-
-    rm.update_current_status("NODEMANAGER", "INIT")
-    rm.update_desired_status("NODEMANAGER", "STARTED")
-
-    # Starts at 1100
-    commands = rm.get_recovery_commands()
-    self.assertEqual(1, len(commands))
-    self.assertEqual("INSTALL", commands[0]["roleCommand"])
-
-    rm.update_current_status("NODEMANAGER", "INIT")
-    rm.update_desired_status("NODEMANAGER", "INSTALLED")
-
-    # Starts at 1200
-    commands = rm.get_recovery_commands()
-    self.assertEqual(1, len(commands))
-    self.assertEqual("INSTALL", commands[0]["roleCommand"])
-
-    rm.update_config(2, 5, 1, 5, True, True, False, "", -1)
-    rm.update_current_status("NODEMANAGER", "INIT")
-    rm.update_desired_status("NODEMANAGER", "INSTALLED")
-
-    commands = rm.get_recovery_commands()
-    self.assertEqual(0, len(commands))
-
-    rm.update_config(12, 5, 1, 15, True, False, False, "NODEMANAGER", -1)
-    rm.update_current_status("NODEMANAGER", "INIT")
-    rm.update_desired_status("NODEMANAGER", "INSTALLED")
-
-    rm.store_or_update_command(command1)
-    commands = rm.get_recovery_commands()
-    self.assertEqual(1, len(commands))
-    self.assertEqual("INSTALL", commands[0]["roleCommand"])
-
-    rm.update_config_staleness("NODEMANAGER", False)
-    rm.update_current_status("NODEMANAGER", "INSTALLED")
-    rm.update_desired_status("NODEMANAGER", "INSTALLED")
-    commands = rm.get_recovery_commands()
-    self.assertEqual(0, len(commands))
-
-    command_install = copy.deepcopy(self.command)
-    command_install["desiredState"] = "INSTALLED"
-    rm.store_or_update_command(command_install)
-    rm.update_config_staleness("NODEMANAGER", True)
-    commands = rm.get_recovery_commands()
-    self.assertEqual(1, len(commands))
-    self.assertEqual("INSTALL", commands[0]["roleCommand"])
-
-    rm.update_current_status("NODEMANAGER", "STARTED")
-    rm.update_desired_status("NODEMANAGER", "STARTED")
-    commands = rm.get_recovery_commands()
-    self.assertEqual(1, len(commands))
-    self.assertEqual("CUSTOM_COMMAND", commands[0]["roleCommand"])
-    self.assertEqual("RESTART", commands[0]["hostLevelParams"]["custom_command"])
-
-    rm.update_current_status("NODEMANAGER", "STARTED")
-    rm.update_desired_status("NODEMANAGER", "INSTALLED")
-    commands = rm.get_recovery_commands()
-    self.assertEqual(1, len(commands))
-    self.assertEqual("STOP", commands[0]["roleCommand"])
-
-    rm.update_config(12, 5, 1, 15, True, False, True, "NODEMANAGER", -1)
-    rm.update_current_status("NODEMANAGER", "INSTALL_FAILED")
-    rm.update_desired_status("NODEMANAGER", "INSTALLED")
-    commands = rm.get_recovery_commands()
-    self.assertEqual(1, len(commands))
-    self.assertEqual("INSTALL", commands[0]["roleCommand"])
-    pass
-
   @patch.object(RecoveryManager, "update_config")
   def test_update_rm_config(self, mock_uc):
     rm = RecoveryManager(tempfile.mktemp())
-    rm.update_configuration_from_registration(None)
-    mock_uc.assert_has_calls([call(6, 60, 5, 12, False, False, False, "", -1)])
+    rm.update_recovery_config(None)
+    mock_uc.assert_has_calls([call(6, 60, 5, 12, False, False, False, "")])
 
     mock_uc.reset_mock()
-    rm.update_configuration_from_registration({})
-    mock_uc.assert_has_calls([call(6, 60, 5, 12, False, False, False, "", -1)])
+    rm.update_recovery_config({})
+    mock_uc.assert_has_calls([call(6, 60, 5, 12, False, False, False, "")])
 
     mock_uc.reset_mock()
-    rm.update_configuration_from_registration(
+    rm.update_recovery_config(
       {"recoveryConfig": {
       "type" : "DEFAULT"}}
     )
-    mock_uc.assert_has_calls([call(6, 60, 5, 12, False, False, False, "", -1)])
+    mock_uc.assert_has_calls([call(6, 60, 5, 12, False, False, False, "")])
 
     mock_uc.reset_mock()
-    rm.update_configuration_from_registration(
+    rm.update_recovery_config(
       {"recoveryConfig": {
         "type" : "FULL"}}
     )
-    mock_uc.assert_has_calls([call(6, 60, 5, 12, True, False, False, "", -1)])
+    mock_uc.assert_has_calls([call(6, 60, 5, 12, True, False, False, "")])
 
     mock_uc.reset_mock()
-    rm.update_configuration_from_registration(
+    rm.update_recovery_config(
       {"recoveryConfig": {
         "type" : "AUTO_START",
         "max_count" : "med"}}
     )
-    mock_uc.assert_has_calls([call(6, 60, 5, 12, True, True, False, "", -1)])
+    mock_uc.assert_has_calls([call(6, 60, 5, 12, True, True, False, "")])
 
     mock_uc.reset_mock()
-    rm.update_configuration_from_registration(
+    rm.update_recovery_config(
       {"recoveryConfig": {
         "type" : "AUTO_INSTALL_START",
         "max_count" : "med"}}
     )
-    mock_uc.assert_has_calls([call(6, 60, 5, 12, True, False, True, "", -1)])
+    mock_uc.assert_has_calls([call(6, 60, 5, 12, True, False, True, "")])
 
     mock_uc.reset_mock()
-    rm.update_configuration_from_registration(
+    rm.update_recovery_config(
       {"recoveryConfig": {
         "type" : "AUTO_START",
         "maxCount" : "5",
@@ -514,7 +344,7 @@ class _TestRecoveryManager(TestCase):
         "components" : " A,B",
         "recoveryTimestamp" : 1}}
     )
-    mock_uc.assert_has_calls([call(5, 20, 2, 5, True, True, False, " A,B", 1)])
+    mock_uc.assert_has_calls([call(5, 20, 2, 5, True, True, False, " A,B")])
   pass
 
   @patch.object(RecoveryManager, "_now_")
@@ -526,7 +356,7 @@ class _TestRecoveryManager(TestCase):
     rec_st = rm.get_recovery_status()
     self.assertEquals(rec_st, {"summary": "DISABLED"})
 
-    rm.update_config(2, 5, 1, 4, True, True, False, "", -1)
+    rm.update_config(2, 5, 1, 4, True, True, False, "")
     rec_st = rm.get_recovery_status()
     self.assertEquals(rec_st, {"summary": "RECOVERABLE", "componentReports": []})
 
@@ -567,15 +397,15 @@ class _TestRecoveryManager(TestCase):
   @patch.object(RecoveryManager, "_now_")
   def test_command_expiry(self, time_mock):
     time_mock.side_effect = \
-      [1000, 1001, 1002, 1003, 1104, 1105, 1106, 1807, 1808, 1809, 1810, 1811, 1812]
+      [1000, 1001, 1104, 1105, 1106, 1807, 1808, 1809, 1810, 1811, 1812]
 
     rm = RecoveryManager(tempfile.mktemp(), True)
-    rm.update_config(5, 5, 1, 11, True, False, False, "", -1)
+    rm.update_config(5, 5, 0, 11, True, False, False, "")
 
     command1 = copy.deepcopy(self.command)
 
-    rm.store_or_update_command(command1)
-    rm.update_config(12, 5, 1, 15, True, False, False, "NODEMANAGER", -1)
+    #rm.store_or_update_command(command1)
+    rm.update_config(12, 5, 1, 15, True, False, False, "NODEMANAGER")
     rm.update_current_status("NODEMANAGER", "INSTALLED")
     rm.update_desired_status("NODEMANAGER", "STARTED")
 
@@ -586,49 +416,38 @@ class _TestRecoveryManager(TestCase):
     commands = rm.get_recovery_commands()
     self.assertEqual(1, len(commands))
     self.assertEqual("START", commands[0]["roleCommand"])
+    
+    rm.retry_gap_in_sec = 60
 
     #1807 command is stale
     commands = rm.get_recovery_commands()
     self.assertEqual(0, len(commands))
 
-    rm.store_or_update_command(command1)
     commands = rm.get_recovery_commands()
     self.assertEqual(1, len(commands))
     self.assertEqual("START", commands[0]["roleCommand"])
     pass
 
-  def test_command_count(self):
-    rm = RecoveryManager(tempfile.mktemp(), True)
-    self.assertFalse(rm.has_active_command())
-    rm.start_execution_command()
-    self.assertTrue(rm.has_active_command())
-    rm.start_execution_command()
-    self.assertTrue(rm.has_active_command())
-    rm.stop_execution_command()
-    self.assertTrue(rm.has_active_command())
-    rm.stop_execution_command()
-    self.assertFalse(rm.has_active_command())
-
   def test_configured_for_recovery(self):
     rm = RecoveryManager(tempfile.mktemp(), True)
-    rm.update_config(12, 5, 1, 15, True, False, False, "A,B", -1)
+    rm.update_config(12, 5, 1, 15, True, False, False, "A,B")
     self.assertTrue(rm.configured_for_recovery("A"))
     self.assertTrue(rm.configured_for_recovery("B"))
 
-    rm.update_config(5, 5, 1, 11, True, False, False, "", -1)
+    rm.update_config(5, 5, 1, 11, True, False, False, "")
     self.assertFalse(rm.configured_for_recovery("A"))
     self.assertFalse(rm.configured_for_recovery("B"))
 
-    rm.update_config(5, 5, 1, 11, True, False, False, "A", -1)
+    rm.update_config(5, 5, 1, 11, True, False, False, "A")
     self.assertTrue(rm.configured_for_recovery("A"))
     self.assertFalse(rm.configured_for_recovery("B"))
 
-    rm.update_config(5, 5, 1, 11, True, False, False, "A", -1)
+    rm.update_config(5, 5, 1, 11, True, False, False, "A")
     self.assertTrue(rm.configured_for_recovery("A"))
     self.assertFalse(rm.configured_for_recovery("B"))
     self.assertFalse(rm.configured_for_recovery("C"))
 
-    rm.update_config(5, 5, 1, 11, True, False, False, "A, D, F ", -1)
+    rm.update_config(5, 5, 1, 11, True, False, False, "A, D, F ")
     self.assertTrue(rm.configured_for_recovery("A"))
     self.assertFalse(rm.configured_for_recovery("B"))
     self.assertFalse(rm.configured_for_recovery("C"))
@@ -642,7 +461,7 @@ class _TestRecoveryManager(TestCase):
       [1000, 1071, 1372]
     rm = RecoveryManager(tempfile.mktemp(), True)
 
-    rm.update_config(2, 5, 1, 4, True, True, False, "", -1)
+    rm.update_config(2, 5, 1, 4, True, True, False, "")
 
     rm.execute("COMPONENT")
     actions = rm.get_actions_copy()["COMPONENT"]
@@ -660,7 +479,7 @@ class _TestRecoveryManager(TestCase):
   def test_is_action_info_stale(self, time_mock):
 
     rm = RecoveryManager(tempfile.mktemp(), True)
-    rm.update_config(5, 60, 5, 16, True, False, False, "", -1)
+    rm.update_config(5, 60, 5, 16, True, False, False, "")
 
     time_mock.return_value = 0
     self.assertFalse(rm.is_action_info_stale("COMPONENT_NAME"))
diff --git a/ambari-agent/src/test/python/resource_management/TestScript.py b/ambari-agent/src/test/python/resource_management/TestScript.py
index 79d0598..4bd26fd 100644
--- a/ambari-agent/src/test/python/resource_management/TestScript.py
+++ b/ambari-agent/src/test/python/resource_management/TestScript.py
@@ -36,24 +36,31 @@ class TestScript(RMFTestCase):
   @patch("resource_management.core.providers.package.PackageProvider")
   def test_install_packages(self, package_provider_mock):
     no_packages_config = {
-      'hostLevelParams' : {
+      'commandParams': {
+        'package_list' : ''
+      },
+      'ambariLevelParams' : {
         'repo_info' : "[{\"baseUrl\":\"http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0\",\"osType\":\"centos6\",\"repoId\":\"HDP-2.0._\",\"repoName\":\"HDP\",\"defaultBaseUrl\":\"http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0\"}]",
         'agent_stack_retry_count': '5',
         'agent_stack_retry_on_unavailability': 'false'
       }
     }
     empty_config = {
-      'hostLevelParams' : {
-        'package_list' : '',
+      'commandParams': {
+        'package_list' : ''
+      },
+      'ambariLevelParams' : {
         'repo_info' : "[{\"baseUrl\":\"http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0\",\"osType\":\"centos6\",\"repoId\":\"HDP-2.0._\",\"repoName\":\"HDP\",\"defaultBaseUrl\":\"http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0\"}]",
         'agent_stack_retry_count': '5',
         'agent_stack_retry_on_unavailability': 'false'
       }
     }
     dummy_config = {
-      'hostLevelParams' : {
+      'commandParams' : {
         'package_list' : "[{\"type\":\"rpm\",\"name\":\"hbase\", \"condition\": \"\"},"
                          "{\"type\":\"rpm\",\"name\":\"yet-another-package\", \"condition\": \"\"}]",
+      },                 
+      'ambariLevelParams' : {
         'repo_info' : "[{\"baseUrl\":\"http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0\",\"osType\":\"centos6\",\"repoId\":\"HDP-2.0._\",\"repoName\":\"HDP\",\"defaultBaseUrl\":\"http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0\"}]",
         'service_repo_info' : "[{\"mirrorsList\":\"abc\",\"osType\":\"centos6\",\"repoId\":\"HDP-2.0._\",\"repoName\":\"HDP\",\"defaultBaseUrl\":\"http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.0.6.0\"}]",
         'agent_stack_retry_count': '5',

-- 
To stop receiving notification emails like this one, please contact
aonishuk@apache.org.