From 6d6259490b9c0897ba493070516600fcff94b312 Mon Sep 17 00:00:00 2001 From: Yujun Zhang Date: Wed, 12 Apr 2017 17:08:23 +0800 Subject: Load benchmark specification from external file Change-Id: If72f1d98b90f9666c17aa28b3b88f32178ee4166 Signed-off-by: Yujun Zhang --- qtip/ansible_library/plugins/action/calculate.py | 5 ++- tests/integration/run.yaml | 30 +-------------- tests/integration/specs/compute.yaml | 48 ++++++++++++------------ 3 files changed, 29 insertions(+), 54 deletions(-) diff --git a/qtip/ansible_library/plugins/action/calculate.py b/qtip/ansible_library/plugins/action/calculate.py index f88729b7..ac7f10f2 100644 --- a/qtip/ansible_library/plugins/action/calculate.py +++ b/qtip/ansible_library/plugins/action/calculate.py @@ -10,6 +10,7 @@ ############################################################################## from numpy import mean +import yaml from ansible.plugins.action import ActionBase from ansible.utils.display import Display @@ -28,7 +29,9 @@ class ActionModule(ActionBase): if result.get('skipped', False): return result - spec = self._task.args.get('spec') + with open(self._task.args.get('spec')) as stream: + spec = yaml.safe_load(stream) + metrics = self._task.args.get('metrics') return calc_qpi(spec, metrics) diff --git a/tests/integration/run.yaml b/tests/integration/run.yaml index d2768d68..704ce831 100644 --- a/tests/integration/run.yaml +++ b/tests/integration/run.yaml @@ -29,35 +29,7 @@ calculate: metrics: ssl_rsa: "{{ openssl_rsa_metrics }}" - spec: # TODO(yujunz) load spec from file - name: compute - description: QTIP Performance Index of compute - formula: weighted arithmetic mean - sections: # split based on different application - - name: SSL - description: cryptography and SSL/TLS performance - formula: geometric mean - metrics: - - name: ssl_rsa - formual: geometric mean - workloads: - - name: rsa_sign_512 - description: RSA signature 512 bits - baseline: 14982.3 - - name: rsa_verify_512 - baseline: 180619.2 - - name: rsa_sign_1024 - baseline: 5037.7 - - name: rsa_verify_1024 - baseline: 67359.9 - - name: rsa_sign_2048 - baseline: 713.6 - - name: rsa_verify_2048 - baseline: 23458.0 - - name: rsa_sign_4096 - baseline: 102.1 - - name: rsa_verify_4096 - baseline: 6402.9 + spec: specs/compute.yaml register: qpi_result delegate_to: localhost tags: [calculate] diff --git a/tests/integration/specs/compute.yaml b/tests/integration/specs/compute.yaml index 0266ac8d..736aef22 100644 --- a/tests/integration/specs/compute.yaml +++ b/tests/integration/specs/compute.yaml @@ -10,27 +10,27 @@ name: compute description: QTIP Performance Index of compute formula: weighted arithmetic mean sections: # split based on different application -- name: SSL - description: cryptography and SSL/TLS performance - formula: geometric mean - metrics: - - name: rsa - formual: geometric mean - workloads: - - name: rsa_sign_512 - description: RSA signature 512 bits - baseline: 14982.3 - - name: rsa_verify_512 - baseline: 180619.2 - - name: rsa_sign_1024 - baseline: 5037.7 - - name: rsa_verify_1024 - baseline: 67359.9 - - name: rsa_sign_2048 - baseline: 713.6 - - name: rsa_verify_2048 - baseline: 23458.0 - - name: rsa_sign_4096 - baeline: 102.1 - - name: rsa_verify_4096 - baseline: 6402.9 + - name: SSL + description: cryptography and SSL/TLS performance + formula: geometric mean + metrics: + - name: ssl_rsa + formual: geometric mean + workloads: + - name: rsa_sign_512 + description: RSA signature 512 bits + baseline: 14982.3 + - name: rsa_verify_512 + baseline: 180619.2 + - name: rsa_sign_1024 + baseline: 5037.7 + - name: rsa_verify_1024 + baseline: 67359.9 + - name: rsa_sign_2048 + baseline: 713.6 + - name: rsa_verify_2048 + baseline: 23458.0 + - name: rsa_sign_4096 + baseline: 102.1 + - name: rsa_verify_4096 + baseline: 6402.9 -- cgit 1.2.3-korg