ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aonis...@apache.org
Subject ambari git commit: AMBARI-13307. Agent instance memory footprint likely gradually growing (aonishuk)
Date Tue, 06 Oct 2015 15:03:39 GMT
Repository: ambari
Updated Branches:
  refs/heads/branch-2.1 00aabde5e -> 32a5c51c9


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


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

Branch: refs/heads/branch-2.1
Commit: 32a5c51c90b0c522be2ea640d34e38b11849550a
Parents: 00aabde
Author: Andrew Onishuk <aonishuk@hortonworks.com>
Authored: Tue Oct 6 18:01:33 2015 +0300
Committer: Andrew Onishuk <aonishuk@hortonworks.com>
Committed: Tue Oct 6 18:01:33 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/32a5c51c/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/32a5c51c/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


Mime
View raw message