Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                
Skip to content

Commit cec7122

Browse files
committed
Nodes logs by id, fetching conf & dumping vars after benchmark.
1 parent 73bcf3d commit cec7122

File tree

4 files changed

+67
-5
lines changed

4 files changed

+67
-5
lines changed

devops/logs.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,20 @@
1414
dest: "{{ logs }}/{{ inventory_hostname }}.log"
1515
validate_checksum: no # new logs might constantly arrive
1616
flat: yes
17+
tags:
18+
fetch
19+
20+
- name: find out node id from log
21+
local_action: shell grep -m 1 -o -P 'SHND \d' logs/{{ inventory_hostname }}.log | sed 's/SHND //'
22+
register: node_id
23+
tags:
24+
node_symlink
25+
26+
- name: create symlink 'node_id'.log -> 'ip'.log
27+
local_action: file
28+
src={{ inventory_hostname }}.log
29+
dest={{ logs }}/{{ node_id.stdout }}.log
30+
state=link
1731

1832
- name: touch logs/united.log
1933
local_action: copy content="" dest={{ logs }}/united.log
@@ -24,7 +38,7 @@
2438
with_items: "{{ groups.nodes }}"
2539
run_once: true
2640

27-
- name: create symlink to shadlord log
41+
- name: create symlink to shardlord log
2842
local_action: file
2943
src={{ groups['shardlord'][0] }}.log
3044
dest={{ logs }}/shardlord.log

devops/pgbench_run.yml

Lines changed: 30 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,10 @@
1-
### create pgbench_history everywhere, create pgbench tables on init node,
2-
# shard them. TODO: drop sharded tables.
1+
### Run pgbench benchmark.
32
# Controlling vars: tmstmp (true/false), tname, clients, t (true/false),
43
# seconds, xacts
54

65

76
# set global var to use in all plays, oh my
8-
- hosts: nodes
7+
- hosts: nodes:localhost
98
vars:
109
tmstmp: True
1110
tname: pgbench
@@ -67,6 +66,34 @@
6766
res/{{ test_id }}/tps.txt`" >> res/{{test_id}}/tps.txt
6867
run_once: true
6968

69+
- name: collect worker conf
70+
fetch:
71+
src: "{{ pg_conffile }}"
72+
dest: res/{{ test_id }}/postgresql.conf.worker
73+
flat: yes
74+
run_once: true
75+
7076
- import_playbook: logs.yml logs=res/{{ test_id }}/logs
7177
tags:
7278
- logs
79+
80+
- hosts: shardlord
81+
tasks:
82+
- name: collect shardlord conf
83+
fetch:
84+
src: "{{ pg_conffile }}"
85+
dest: res/{{ test_id }}/postgresql.conf.lord
86+
flat: yes
87+
run_once: true
88+
89+
- hosts: localhost
90+
tasks:
91+
- name: Dump all vars
92+
action: template src=templates/dumpallvars.j2 dest=res/{{ test_id }}/allvars.txt
93+
94+
- name: print tps
95+
local_action: shell cat res/{{ test_id }}/tps.txt
96+
register: tps
97+
run_once: true
98+
99+
- debug: msg={{ tps.stdout }}

devops/tasks/pg_ctl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
---
22

3-
- name: pg_ctl {{pg_ctl_action}}
3+
- name: pg_ctl {{pg_ctl_action}} -l {{ pg_logfile }}
44
command: "{{pg_dst}}/bin/pg_ctl {{pg_ctl_action}} -D {{pg_datadir}} -l {{pg_logfile}}"

devops/templates/dumpallvars.j2

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
{# Taken from https://coderwall.com/p/13lh6w/dump-all-variables #}
2+
3+
Module Variables ("vars"):
4+
--------------------------------
5+
{{ vars | to_nice_json }}
6+
7+
Environment Variables ("environment"):
8+
--------------------------------
9+
{{ environment | to_nice_json }}
10+
11+
GROUP NAMES Variables ("group_names"):
12+
--------------------------------
13+
{{ group_names | to_nice_json }}
14+
15+
GROUPS Variables ("groups"):
16+
--------------------------------
17+
{{ groups | to_nice_json }}
18+
19+
HOST Variables ("hostvars"):
20+
--------------------------------
21+
{{ hostvars | to_nice_json }}

0 commit comments

Comments
 (0)