-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathgeneral.py
More file actions
197 lines (188 loc) · 5.95 KB
/
general.py
File metadata and controls
197 lines (188 loc) · 5.95 KB
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
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
"""
These are common steps that any of tests may use.
"""
from buildbot.plugins import steps, util
PROPERTIES = [
util.FileParameter(
name="custom_postgresql.conf",
label="Upload postgresql.conf overrides",
default=""
),
util.FileParameter(
name="postgresql.patch",
label="Upload PostgreSQL patch (must be base64 encoded)",
default=""
),
util.FileParameter(
name="dbt.patch",
label="Upload DBT kit patch (must be base64 encoded)",
default=""
),
]
CLEANUP = [
steps.RemoveDirectory(
name="Remove previous load logs",
dir=util.Interpolate("%(prop:builddir)s/load"),
),
steps.RemoveDirectory(
name="Remove previous pgdata",
dir=util.Interpolate("%(prop:builddir)s/pgdata"),
),
steps.RemoveDirectory(
name="Remove previous results",
dir=util.Interpolate("%(prop:builddir)s/results"),
),
steps.RemoveDirectory(
name="Remove previous test installation",
dir=util.Interpolate("%(prop:builddir)s/usr"),
),
]
PATCHDBT = [
steps.ShellCommand(
name="Apply DBT kit patch",
doStepIf=lambda step: step.build.getProperties(). \
hasProperty("dbt.patch") and \
step.build.getProperty("dbt.patch"),
command=[
'sh', '-c',
util.Interpolate(
"echo \"%(prop:dbt.patch)s\" > ../dbt.patch && "
"base64 -d ../dbt.patch | patch -p1"
),
],
haltOnFailure=True,
workdir=util.Interpolate("%(prop:buildername)s"),
)
]
STATS_SYSTEM = [
steps.ShellCommand(
name="Operating system kernel parameters",
command=['sysctl', '-a'],
env={'PATH': "/sbin:${PATH}"},
alwaysRun=True,
),
steps.ShellCommand(
name="PostgreSQL log",
command=[
'cat',
util.Interpolate("%(prop:builddir)s/pgdata/pg.log"),
],
alwaysRun=True,
),
]
CATPREFIX = "cat %(prop:builddir)s/results/throughput/sysstat"
STATS_DSS = [
steps.ShellCommand(
name="pidstat",
command=['sh', '-c', util.Interpolate(f"{CATPREFIX}/pidstat.txt")],
alwaysRun=True,
),
steps.ShellCommand(
name="Bock Device Stats",
command=[
'sh', '-c',
util.Interpolate(f"{CATPREFIX}/sar/sar-blockdev.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="CPU Stats",
command=[
'sh', '-c', util.Interpolate(f"{CATPREFIX}/sar/sar-cpu.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="Memory Stats",
command=[
'sh', '-c', util.Interpolate(f"{CATPREFIX}/sar/sar-mem.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="Network Stats",
command=[
'sh', '-c', util.Interpolate(f"{CATPREFIX}/sar/sar-net.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="Paging Stats",
command=[
'sh', '-c',
util.Interpolate(f"{CATPREFIX}/sar/sar-paging.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="Swapping Stats",
command=[
'sh', '-c', util.Interpolate(f"{CATPREFIX}/sar/sar-swap.csv"),
],
alwaysRun=True,
),
]
CATPREFIX = "cat %(prop:builddir)s/results/db/*/sysstat"
STATS_OLTP = [
steps.ShellCommand(
name="pidstat",
command=['sh', '-c', util.Interpolate(f"{CATPREFIX}/pidstat.txt")],
alwaysRun=True,
),
steps.ShellCommand(
name="Bock Device Stats",
command=[
'sh', '-c',
util.Interpolate(f"{CATPREFIX}/sar/sar-blockdev.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="CPU Stats",
command=[
'sh', '-c', util.Interpolate(f"{CATPREFIX}/sar/sar-cpu.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="Memory Stats",
command=[
'sh', '-c', util.Interpolate(f"{CATPREFIX}/sar/sar-mem.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="Network Stats",
command=[
'sh', '-c', util.Interpolate(f"{CATPREFIX}/sar/sar-net.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="Paging Stats",
command=[
'sh', '-c',
util.Interpolate(f"{CATPREFIX}/sar/sar-paging.csv"),
],
alwaysRun=True,
),
steps.ShellCommand(
name="Swapping Stats",
command=[
'sh', '-c', util.Interpolate(f"{CATPREFIX}/sar/sar-swap.csv"),
],
alwaysRun=True,
),
]
def IsForceScheduler(step):
'''Check if the force scheduler was used, which uses a naming convention
that starts with run-'''
if step.getProperty("scheduler").startswith("run-"):
return True
return False
def IsNotForceScheduler(step):
'''Check if the force scheduler was not used, which uses a naming
convention that starts with run-'''
if IsForceScheduler(step):
return False
return True