Skip to content

Commit 9cdf3a8

Browse files
authored
Merge pull request #6 from stackhpc/fix/fio-test
Fixes for fiotests
2 parents 80c7b7c + 8c42b99 commit 9cdf3a8

File tree

2 files changed

+48
-9
lines changed

2 files changed

+48
-9
lines changed

chart/templates/clusterrole.yaml

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ rules:
2525
- openfoams.perftest.stackhpc.com
2626
- rdmabandwidths.perftest.stackhpc.com
2727
- rdmalatencies.perftest.stackhpc.com
28+
- fios.perftest.stackhpc.com
2829
verbs:
2930
- update
3031
- patch
@@ -73,14 +74,23 @@ rules:
7374
- services
7475
verbs:
7576
- "*"
76-
# We need to be able to watch pods and fetch their logs
77+
# We need to be able to watch endpoints and pod logs
7778
- apiGroups:
7879
- ""
7980
resources:
8081
- endpoints
81-
- pods
8282
- pods/log
8383
verbs:
8484
- list
8585
- get
8686
- watch
87+
# We need to be able to watch and update pods
88+
- apiGroups:
89+
- ""
90+
resources:
91+
- pods
92+
verbs:
93+
- list
94+
- get
95+
- watch
96+
- patch

python/perftest/models/v1alpha1/fio.py

Lines changed: 36 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
from ...config import settings
1111
from ...errors import PodLogFormatError, PodResultsIncompleteError
12+
from ...utils import format_amount
1213

1314
from . import base
1415

@@ -160,6 +161,22 @@ class FioStatus(base.BenchmarkStatus):
160161
None,
161162
description = "The result of the benchmark."
162163
)
164+
read_bw_result: t.Optional[schema.IntOrString] = Field(
165+
None,
166+
description = "The summary result for read bw, used for display."
167+
)
168+
write_bw_result: t.Optional[schema.IntOrString] = Field(
169+
None,
170+
description = "The summary result for write bw, used for display."
171+
)
172+
read_iops_result: t.Optional[schema.confloat(ge = 0)] = Field(
173+
None,
174+
description = "The summary result for read IOPs, used for display."
175+
)
176+
write_iops_result: t.Optional[schema.confloat(ge = 0)] = Field(
177+
None,
178+
description = "The summary result for write IOPs, used for display."
179+
)
163180
master_pod: t.Optional[base.PodInfo] = Field(
164181
None,
165182
description = "Pod information for the Fio master pod."
@@ -224,23 +241,23 @@ class Fio(
224241
},
225242
{
226243
"name": "Read Bandwidth",
227-
"type": "number",
228-
"jsonPath": ".status.result.readBw",
244+
"type": "string",
245+
"jsonPath": ".status.readBwResult",
229246
},
230247
{
231248
"name": "Read IOPS",
232249
"type": "number",
233-
"jsonPath": ".status.result.readIops",
250+
"jsonPath": ".status.readIopsResult",
234251
},
235252
{
236253
"name": "Write Bandwidth",
237-
"type": "number",
238-
"jsonPath": ".status.result.writeBw",
254+
"type": "string",
255+
"jsonPath": ".status.writeBwResult",
239256
},
240257
{
241258
"name": "Write IOPS",
242259
"type": "number",
243-
"jsonPath": ".status.result.writeIops",
260+
"jsonPath": ".status.writeIopsResult",
244261
}
245262
]
246263
):
@@ -281,8 +298,20 @@ def summarise(self):
281298
except:
282299
raise PodLogFormatError("pod log is not of the expected format")
283300

284-
aggregate_data = [i for i in fio_json['client_stats'] if i['jobname'] == 'All clients'][0]
301+
if len(fio_json['client_stats']) == 1:
302+
# Single worker, single process doesn't have an
303+
# 'All clients' log section
304+
aggregate_data = fio_json['client_stats'][0]
305+
else:
306+
aggregate_data = [i for i in fio_json['client_stats'] if i['jobname'] == 'All clients'][0]
307+
308+
# Format results nicely for printing
309+
self.status.read_bw_result = "{0} {1}B/s".format(*format_amount(aggregate_data['read']['bw'], "K"))
310+
self.status.write_bw_result = "{0} {1}B/s".format(*format_amount(aggregate_data['write']['bw'], "K"))
311+
self.status.write_iops_result = round(aggregate_data['write']['iops'], 2)
312+
self.status.read_iops_result = round(aggregate_data['read']['iops'], 2)
285313

314+
# Use unformatted data for full fioresult
286315
self.status.result = FioResult(
287316
read_bw = aggregate_data['read']['bw'],
288317
read_iops = aggregate_data['read']['iops'],

0 commit comments

Comments
 (0)