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

nwang pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/incubator-heron.git


The following commit(s) were added to refs/heads/master by this push:
     new c27d2c0  Fix max capacity timeline in Heron UI (#3383)
c27d2c0 is described below

commit c27d2c0046996bb2f260f83952ad6483b52f60b8
Author: Ning Wang <[email protected]>
AuthorDate: Mon Oct 28 23:53:12 2019 -0700

    Fix max capacity timeline in Heron UI (#3383)
---
 heron/tools/common/src/python/access/heron_api.py | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/heron/tools/common/src/python/access/heron_api.py 
b/heron/tools/common/src/python/access/heron_api.py
index 709acb4..ebf908d 100644
--- a/heron/tools/common/src/python/access/heron_api.py
+++ b/heron/tools/common/src/python/access/heron_api.py
@@ -867,9 +867,12 @@ class HeronQueryHandler(QueryHandler):
     :param multi_ts:
     :return:
     '''
-    if len(multi_ts) > 0 and len(multi_ts[0]["timeline"]) > 0:
-      keys = multi_ts[0]["timeline"][0]["data"].keys()
-      timelines = ([res["timeline"][0]["data"][key] for key in keys] for res 
in multi_ts)
+    # Some components don't have specific metrics such as capacity hence the
+    # key set is empty. These components are filtered out first.
+    filtered_ts = [ts for ts in multi_ts if len(ts["timeline"][0]["data"]) > 0]
+    if len(filtered_ts) > 0 and len(filtered_ts[0]["timeline"]) > 0:
+      keys = filtered_ts[0]["timeline"][0]["data"].keys()
+      timelines = ([res["timeline"][0]["data"][key] for key in keys] for res 
in filtered_ts)
       values = (max(v) for v in zip(*timelines))
       return dict(zip(keys, values))
     return {}

Reply via email to