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 2015/10/08 10:58:52 UTC

[1/2] ambari git commit: Revert "Revert "AMBARI-13307. Agent instance memory footprint likely gradually growing (aonishuk)""

Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 7ac3e529f -> 8ef722dc3


Revert "Revert "AMBARI-13307. Agent instance memory footprint likely gradually growing (aonishuk)""

This reverts commit 68395ded0d2f6174b9f13a6b6ad0c800308b7d74.


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

Branch: refs/heads/branch-2.1
Commit: dee7089b1cbec527c56bdd8925fae9e421ef7b10
Parents: 7ac3e52
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Oct 8 11:58:20 2015 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Oct 8 11:58:20 2015 +0300

----------------------------------------------------------------------
 ambari-common/src/main/python/resource_management/core/logger.py | 4 ++++
 1 file changed, 4 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/dee7089b/ambari-common/src/main/python/resource_management/core/logger.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/logger.py b/ambari-common/src/main/python/resource_management/core/logger.py
index 7642c6d..0ea34ff 100644
--- a/ambari-common/src/main/python/resource_management/core/logger.py
+++ b/ambari-common/src/main/python/resource_management/core/logger.py
@@ -37,6 +37,10 @@ class Logger:
   @staticmethod
   def initialize_logger(name='resource_management', logging_level=logging.INFO, format='%(asctime)s - %(message)s'):
     # set up logging (two separate loggers for stderr and stdout with different loglevels)
+    
+    if Logger.logger:
+      return
+    
     logger = logging.getLogger(name)
     logger.setLevel(logging_level)
     formatter = logging.Formatter(format)


[2/2] ambari git commit: Revert "Revert "AMBARI-13307. Agent instance memory footprint likely gradually growing (aonishuk)""

Posted by ao...@apache.org.
Revert "Revert "AMBARI-13307. Agent instance memory footprint likely gradually growing (aonishuk)""

This reverts commit 6930aafa22342d650b94c0c12203daa7f30b819f.


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

Branch: refs/heads/branch-2.1
Commit: 8ef722dc3f60e1b6100be49219df6799203cf49c
Parents: dee7089
Author: Andrew Onishuk <ao...@hortonworks.com>
Authored: Thu Oct 8 11:58:36 2015 +0300
Committer: Andrew Onishuk <ao...@hortonworks.com>
Committed: Thu Oct 8 11:58:36 2015 +0300

----------------------------------------------------------------------
 .../src/main/python/resource_management/core/logger.py      | 6 +-----
 .../python/resource_management/libraries/script/script.py   | 9 +++------
 2 files changed, 4 insertions(+), 11 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/ambari/blob/8ef722dc/ambari-common/src/main/python/resource_management/core/logger.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/core/logger.py b/ambari-common/src/main/python/resource_management/core/logger.py
index 0ea34ff..f126f1e 100644
--- a/ambari-common/src/main/python/resource_management/core/logger.py
+++ b/ambari-common/src/main/python/resource_management/core/logger.py
@@ -36,11 +36,9 @@ class Logger:
   
   @staticmethod
   def initialize_logger(name='resource_management', logging_level=logging.INFO, format='%(asctime)s - %(message)s'):
-    # set up logging (two separate loggers for stderr and stdout with different loglevels)
-    
     if Logger.logger:
       return
-    
+    # set up logging (two separate loggers for stderr and stdout with different loglevels)
     logger = logging.getLogger(name)
     logger.setLevel(logging_level)
     formatter = logging.Formatter(format)
@@ -55,8 +53,6 @@ class Logger:
     logger.addHandler(chout)
 
     Logger.logger = logger
-    
-    return logger, chout, cherr
 
   @staticmethod
   def error(text):

http://git-wip-us.apache.org/repos/asf/ambari/blob/8ef722dc/ambari-common/src/main/python/resource_management/libraries/script/script.py
----------------------------------------------------------------------
diff --git a/ambari-common/src/main/python/resource_management/libraries/script/script.py b/ambari-common/src/main/python/resource_management/libraries/script/script.py
index f43c414..efd34e3 100644
--- a/ambari-common/src/main/python/resource_management/libraries/script/script.py
+++ b/ambari-common/src/main/python/resource_management/libraries/script/script.py
@@ -171,11 +171,9 @@ class Script(object):
     Sets up logging;
     Parses command parameters and executes method relevant to command type
     """
-    logger, chout, cherr = Logger.initialize_logger(__name__)
-    
     # parse arguments
     if len(sys.argv) < 7:
-     logger.error("Script expects at least 6 arguments")
+     print "Script expects at least 6 arguments"
      print USAGE.format(os.path.basename(sys.argv[0])) # print to stdout
      sys.exit(1)
 
@@ -188,8 +186,7 @@ class Script(object):
     Script.tmp_dir = sys.argv[6]
 
     logging_level_str = logging._levelNames[self.logging_level]
-    chout.setLevel(logging_level_str)
-    logger.setLevel(logging_level_str)
+    Logger.initialize_logger(__name__, logging_level=logging_level_str)
 
     # on windows we need to reload some of env variables manually because there is no default paths for configs(like
     # /etc/something/conf on linux. When this env vars created by one of the Script execution, they can not be updated
@@ -208,7 +205,7 @@ class Script(object):
             Script.passwords[get_path_from_configuration(k, Script.config)] = get_path_from_configuration(v, Script.config)
 
     except IOError:
-      logger.exception("Can not read json file with command parameters: ")
+      Logging.logger.exception("Can not read json file with command parameters: ")
       sys.exit(1)
 
     # Run class method depending on a command type