incubator-ambari-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From odiache...@apache.org
Subject git commit: AMBARI-3597. Services API call takes ~20s to respond (odiachenko)
Date Mon, 28 Oct 2013 14:18:22 GMT
Updated Branches:
  refs/heads/trunk ac94d2779 -> 2366731e5


AMBARI-3597. Services API call takes ~20s to respond (odiachenko)


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

Branch: refs/heads/trunk
Commit: 2366731e5f011d9586521cf27eb2c0cf3d7c76b9
Parents: ac94d27
Author: Oleksandr Diachenko <odiachenko@hortonworks.com>
Authored: Mon Oct 28 16:17:11 2013 +0200
Committer: Oleksandr Diachenko <odiachenko@hortonworks.com>
Committed: Mon Oct 28 16:17:11 2013 +0200

----------------------------------------------------------------------
 .../puppet/modules/hdp-ganglia/files/rrd.py     | 31 +++++++++++---------
 1 file changed, 17 insertions(+), 14 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-ambari/blob/2366731e/ambari-agent/src/main/puppet/modules/hdp-ganglia/files/rrd.py
----------------------------------------------------------------------
diff --git a/ambari-agent/src/main/puppet/modules/hdp-ganglia/files/rrd.py b/ambari-agent/src/main/puppet/modules/hdp-ganglia/files/rrd.py
index 2e3f07a..b21f748 100644
--- a/ambari-agent/src/main/puppet/modules/hdp-ganglia/files/rrd.py
+++ b/ambari-agent/src/main/puppet/modules/hdp-ganglia/files/rrd.py
@@ -154,20 +154,23 @@ def _walk(*args, **kwargs):
 for cluster in clusterParts:
   for path, dirs, files in _walk(rrdPath + cluster):
     pathParts = path.split("/")
-    if len(hostParts) == 0 or pathParts[-1] in hostParts:
-      for file in files:
-        for metric in metricParts:
-          doPrintMetric = False
-          if file.endswith(metric + ".rrd"):
-            doPrintMetric = True
-          else:
-            metricRegex = metric + '.rrd$'
-            p = re.compile(metricRegex)
-            if p.match(file):
-              doPrintMetric = True
-
-          if doPrintMetric:
-            printMetric(pathParts[-2], pathParts[-1], file[:-4], os.path.join(path, file),
cf, start, end, resolution, pointInTime)
+    #Process only path which contains files. If no host parameter passed - process all hosts
folders and summary info
+    #If host parameter passed - process only this host folder
+    if len(files) > 0 and (len(hostParts) == 0 or pathParts[-1] in hostParts):
+      for metric in metricParts:
+        file = metric + ".rrd"
+        fileFullPath = os.path.join(path, file)
+        if os.path.exists(fileFullPath):
+          #Exact name of metric
+          printMetric(pathParts[-2], pathParts[-1], file[:-4], os.path.join(path, file),
cf, start, end, resolution, pointInTime)
+        else:
+          #Regex as metric name
+          metricRegex = metric + '\.rrd$'
+          p = re.compile(metricRegex)
+          matchedFiles = filter(p.match, files)
+          for matchedFile in matchedFiles:
+            printMetric(pathParts[-2], pathParts[-1], matchedFile[:-4], os.path.join(path,
matchedFile), cf, start, end, resolution, pointInTime)
+
 
 sys.stdout.write("[AMBARI_END]\n")
 # write end time


Mime
View raw message