diff options
5 files changed, 40 insertions, 17 deletions
diff --git a/qtip/ansible_library/plugins/action/collect.py b/qtip/ansible_library/plugins/action/collect.py index 88ad0e35..e51b8072 100644 --- a/qtip/ansible_library/plugins/action/collect.py +++ b/qtip/ansible_library/plugins/action/collect.py @@ -10,6 +10,7 @@ ############################################################################## from collections import defaultdict +import json import re from ansible.plugins.action import ActionBase @@ -25,11 +26,12 @@ class ActionModule(ActionBase): string = self._task.args.get('string') patterns = self._task.args.get('patterns') + export_to = self._task.args.get('export_to') - return collect(patterns, string) + return collect(patterns, string, export_to) -def collect(patterns, string): +def collect(patterns, string, export_to=None): """collect all named subgroups of the match into a list keyed by subgroup name """ captured = defaultdict(list) @@ -42,4 +44,7 @@ def collect(patterns, string): for (key, value) in match_obj.groupdict().items(): captured[key].append(value) + if export_to is not None: + with open(export_to, 'w+') as f: + f.write(json.dumps(captured, indent=2)) return captured diff --git a/resources/ansible_roles/inxi/tasks/main.yml b/resources/ansible_roles/inxi/tasks/main.yml index 6d041e3f..e7ffd18c 100644 --- a/resources/ansible_roles/inxi/tasks/main.yml +++ b/resources/ansible_roles/inxi/tasks/main.yml @@ -19,6 +19,8 @@ - name: generating log filename set_fact: logfile: "{{ qtip_results }}/inxi.log" + tags: + - always - name: saving output to log copy: @@ -50,13 +52,16 @@ - '.+\sKernel:\s+(?P<kernel>.+)\sConsole' - '.+\s+HDD Total Size:\s+(?P<disk>.+)\s' - '.+\sproduct:\s+(?P<product>.+)\sv' - dump: 'inix.log' + export_to: "{{ qtip_results }}/system_info.json" register: system_info delegate_to: localhost + tags: + - collect - name: create system information report template: src: system-info.j2 dest: "{{ qtip_results }}/system-info" delegate_to: localhost - tags: [report] + tags: + - report diff --git a/resources/ansible_roles/qtip-workspace/files/defaults/run.yml b/resources/ansible_roles/qtip-workspace/files/defaults/run.yml index b76e4573..15b12214 100644 --- a/resources/ansible_roles/qtip-workspace/files/defaults/run.yml +++ b/resources/ansible_roles/qtip-workspace/files/defaults/run.yml @@ -13,33 +13,33 @@ roles: # prepare local environment - - { role: qtip, tasks: setup-local } + - { role: qtip, tasks: setup-local, tags: [setup] } - hosts: compute roles: # prepare environment - - { role: qtip, tasks: setup-node } + - { role: qtip, tasks: setup-node, tags: [setup] } - hosts: compute roles: # run test and collect metrics - - { role: inxi, tags: [inxi, sysinfo] } - - { role: unixbench, tags: [unixbench, float, int] } - - { role: openssl, tags: [openssl, ssl]} - - { role: nDPI, tags: [ndpi, dpi]} - - { role: ramspeed, tags: [ramspeed, mem]} + - { role: inxi, tags: [run, inxi, sysinfo] } + - { role: unixbench, tags: [run, unixbench, arithmetic] } + - { role: openssl, tags: [run, openssl, ssl] } + - { role: nDPI, tags: [run, ndpi, dpi] } + - { role: ramspeed, tags: [run, ramspeed, memory] } # calculate scores - - { role: qtip, tasks: calculate} + - { role: qtip, tasks: calculate, tags: [calculate] } - hosts: localhost roles: # aggregate results and produce report - - { role: qtip, tasks: aggregate } + - { role: qtip, tasks: aggregate, tags: [aggregate] } # publish results - - { role: opnfv-testapi, tasks: report, when: testapi_url is defined} + - { role: opnfv-testapi, tasks: report, when: testapi_url is defined, tags: [report] } diff --git a/resources/ansible_roles/qtip/tasks/setup-local.yml b/resources/ansible_roles/qtip/tasks/setup-local.yml index add58b3e..f5f83278 100644 --- a/resources/ansible_roles/qtip/tasks/setup-local.yml +++ b/resources/ansible_roles/qtip/tasks/setup-local.yml @@ -9,9 +9,20 @@ --- -- name: setting result directory name +- name: formatting directory name for current run set_fact: - qtip_results_base: "{{ qtip_results }}/{{ pod_name }}-{{ lookup('pipe', 'date +%Y%m%d-%H%M') }}" + pod_results: "{{ pod_name }}-{{ lookup('pipe', 'date +%Y%m%d-%H%M') }}" + +- name: creating directory for current run + file: + state: directory + path: "{{ qtip_results }}/{{ pod_results }}" + +- name: creating symbolic link to current test + file: + state: link + src: "{{ pod_results }}" + dest: "{{ qtip_results }}/current" - name: create cache directory file: diff --git a/resources/ansible_roles/qtip/tasks/setup-node.yml b/resources/ansible_roles/qtip/tasks/setup-node.yml index 92ee66bc..af848f70 100644 --- a/resources/ansible_roles/qtip/tasks/setup-node.yml +++ b/resources/ansible_roles/qtip/tasks/setup-node.yml @@ -11,7 +11,9 @@ - name: overriding result directory name set_fact: - qtip_results: "{{ hostvars['localhost']['qtip_results_base']}}/{{ inventory_hostname }}" + qtip_results: "{{ qtip_results }}/current/{{ inventory_hostname }}" + tags: + - always - name: creating result directory file: |