diff options
author | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2017-05-13 21:52:37 +0800 |
---|---|---|
committer | Yujun Zhang <zhang.yujunz@zte.com.cn> | 2017-05-16 11:52:29 +0800 |
commit | ab72f9c49cabd945d35c946dce4158ea8e228e2a (patch) | |
tree | 12a3ea3350db4c761bd90417bff6d900cbb87a7b /qtip/ansible_library/plugins/action/aggregate.py | |
parent | 426ad7b517f20ff8c77ed69dcd056db7d5278f18 (diff) |
Implement sunburst badge for QPI
Change-Id: Iccdec7b0ac223a38c846f73adc6bd0e53db3723b
Signed-off-by: Yujun Zhang <zhang.yujunz@zte.com.cn>
Diffstat (limited to 'qtip/ansible_library/plugins/action/aggregate.py')
-rw-r--r-- | qtip/ansible_library/plugins/action/aggregate.py | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/qtip/ansible_library/plugins/action/aggregate.py b/qtip/ansible_library/plugins/action/aggregate.py index f1451e06..36ea0ef1 100644 --- a/qtip/ansible_library/plugins/action/aggregate.py +++ b/qtip/ansible_library/plugins/action/aggregate.py @@ -42,9 +42,15 @@ class ActionModule(ActionBase): # aggregate QPI results @export_to_file def aggregate(hosts, basepath, src): - host_results = [{'host': host, 'result': json.load(open(os.path.join(basepath, host, src)))} for host in hosts] - score = int(mean([r['result']['score'] for r in host_results])) + host_results = [] + for host in hosts: + host_result = json.load(open(os.path.join(basepath, host, src))) + host_result['name'] = host + host_results.append(host_result) + score = int(mean([r['score'] for r in host_results])) return { 'score': score, - 'host_results': host_results + 'name': 'compute', + 'description': 'POD Compute QPI', + 'children': host_results } |