This repository has been archived by the owner on Nov 4, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
run_benchmark.yml
181 lines (150 loc) · 5.92 KB
/
run_benchmark.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
# SPDX-License-Identifier: BSD-3-Clause
# Copyright 2021-2022, Intel Corporation
#
---
- hosts: utility[0]
become: true
become_user: root
environment:
PATH: "{{ ansible_env.PATH }}:/usr/local/bin"
pre_tasks:
- name: "run_benchmark | Load playbook variables"
include_vars: "vars/vars.yml"
tasks:
- name: "run_benchmark | Clear variables"
set_fact:
namespaces_counter: []
namespaces: []
- name: "run_benchmark | Generate namespaces indexes"
set_fact:
namespaces_counter: "{{ namespaces_counter | default([]) + [ item ] }}"
with_sequence: start=1 end="{{ clusters_count }}"
- name: "run_benchmark | Generate namespaces names"
set_fact:
namespaces: "{{ namespaces | default([]) + [ namespace_prefix + '%s' | format(item) ] }}"
loop: "{{ namespaces_counter }}"
- set_fact:
single_cluster_testcase: "{{ True if clusters_count|int == 1 else False }}"
- name: "run_benchmark | Get nodes with client label"
kubernetes.core.k8s_info:
kind: Node
label_selectors:
- node-type=redis-client
register: labeled_nodes_raw_info
- set_fact:
labeled_nodes_info: "{{ labeled_nodes_info | default([]) + [ item.metadata['name'] ] }}"
with_items: "{{ labeled_nodes_raw_info['resources'] }}"
no_log: true
- name: "run_benchmark | Remove old client labels"
kubernetes.core.k8s:
definition:
apiVersion: v1
kind: Node
metadata:
name: "{{ item }}"
labels:
node-type: null
state: patched
with_items: "{{ labeled_nodes_info }}"
when: labeled_nodes_info is defined
- name: "run_benchmark | Add client labels to nodes"
kubernetes.core.k8s:
definition:
apiVersion: v1
kind: Node
metadata:
name: "{{ item }}"
labels:
node-type: redis-client
state: patched
with_items: "{{ groups['clients'] }}"
- name: "run_benchmark | Create run_tests_timed job config directory"
file:
path: "{{ k8s_definitions_dir }}/{{ redis_cluster_namespace }}/run_tests_timed"
recurse: yes
loop: "{{ namespaces }}"
loop_control:
loop_var: redis_cluster_namespace
- set_fact:
timestamp_file_path: "{{ logdir }}/{{ log_dir_structure }}/{{ run_id }}/timestamp.txt"
- name: "run_benchmark | Get timestamp from file"
set_fact:
exec_stamp: "{{ lookup('file', timestamp_file_path) }}"
- block:
- set_fact:
pods_info_file_path: "{{ logdir }}/{{ log_dir_structure }}/{{ run_id }}/single_redis-cluster_pods_info_raw.txt"
- name: "run_benchmark | Load pods info from file"
set_fact:
pods: "{{ lookup('file', pods_info_file_path) }}"
when: single_cluster_testcase
- block:
- set_fact:
run_count: "1"
- set_fact:
run_tests_job_name: "bench-run-tests-{{ run_id }}-{{ run_count }}run"
- include_tasks: "include/tasks/create_job_config.yml"
vars:
job_name: "{{ run_tests_job_name }}"
kustomization_dir: "run_tests_timed"
namespace: "{{ redis_cluster_namespace }}"
templates_path: "{{ playbook_dir }}/templates"
loop: "{{ namespaces }}"
loop_control:
loop_var: redis_cluster_namespace
- include_tasks: "include/tasks/benchmark_clusters.yml"
vars:
benchmark_namespaces: "{{ namespaces }}"
job_name: "{{ run_tests_job_name }}"
k8s_definitions_dir_path: "{{ k8s_definitions_dir }}"
when: warm_up_benchmark_run
- set_fact:
run_count: "{{ run_count }}"
- set_fact:
run_tests_job_name: "bench-run-tests-{{ run_id }}-{{ run_count }}run"
- include_tasks: "include/tasks/create_job_config.yml"
vars:
job_name: "{{ run_tests_job_name }}"
kustomization_dir: "run_tests_timed"
namespace: "{{ redis_cluster_namespace }}"
templates_path: "{{ playbook_dir }}/templates"
job_node_name: "{{ groups['clients'][index % (groups['clients'] | length)] }}"
loop: "{{ namespaces }}"
loop_control:
loop_var: redis_cluster_namespace
index_var: index
- import_playbook: "include/playbooks/run_emon.yml"
vars:
exec_stamp: "{{ hostvars[groups['utility'][0]]['exec_stamp'] }}"
run_id: "{{ hostvars[groups['utility'][0]]['run_id'] }}"
when: hostvars[groups['utility'][0]]['collect_emon_data']
- hosts: utility[0]
become: true
become_user: root
environment:
PATH: "{{ ansible_env.PATH }}:/usr/local/bin"
pre_tasks:
- name: "run_benchmark | Load playbook variables"
include_vars: "vars/vars.yml"
tasks:
- include_tasks: "include/tasks/benchmark_clusters.yml"
vars:
benchmark_namespaces: "{{ namespaces }}"
job_name: "{{ run_tests_job_name }}"
k8s_definitions_dir_path: "{{ k8s_definitions_dir }}"
- import_playbook: "include/playbooks/stop_emon.yml"
when: hostvars[groups['utility'][0]]['collect_emon_data']
- import_playbook: "include/playbooks/process_emon.yml"
vars:
exec_stamp: "{{ hostvars[groups['utility'][0]]['exec_stamp'] }}"
pods_info: "{{ hostvars[groups['utility'][0]]['pods'] }}"
processing_script_path: "{{ playbook_dir }}/../../utils"
run_id: "{{ hostvars[groups['utility'][0]]['run_id'] }}"
single_cluster_testcase: "{{ hostvars[groups['utility'][0]]['single_cluster_testcase'] }}"
when: hostvars[groups['utility'][0]]['collect_emon_data']
- import_playbook: "include/playbooks/process_memtier_results.yml"
vars:
clusters_count: "{{ hostvars[groups['utility'][0]]['clusters_count'] }}"
exec_stamp: "{{ hostvars[groups['utility'][0]]['exec_stamp'] }}"
run_id: "{{ hostvars[groups['utility'][0]]['run_id'] }}"
single_cluster_testcase: "{{ hostvars[groups['utility'][0]]['single_cluster_testcase'] }}"
# vi:et:sw=2 ts=2 sts=2 ft=ansible