|
9 | 9 |
|
10 | 10 | from ...config import settings
|
11 | 11 | from ...errors import PodLogFormatError, PodResultsIncompleteError
|
| 12 | +from ...utils import format_amount |
12 | 13 |
|
13 | 14 | from . import base
|
14 | 15 |
|
@@ -160,6 +161,22 @@ class FioStatus(base.BenchmarkStatus):
|
160 | 161 | None,
|
161 | 162 | description = "The result of the benchmark."
|
162 | 163 | )
|
| 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 | + ) |
163 | 180 | master_pod: t.Optional[base.PodInfo] = Field(
|
164 | 181 | None,
|
165 | 182 | description = "Pod information for the Fio master pod."
|
@@ -224,23 +241,23 @@ class Fio(
|
224 | 241 | },
|
225 | 242 | {
|
226 | 243 | "name": "Read Bandwidth",
|
227 |
| - "type": "number", |
228 |
| - "jsonPath": ".status.result.readBw", |
| 244 | + "type": "string", |
| 245 | + "jsonPath": ".status.readBwResult", |
229 | 246 | },
|
230 | 247 | {
|
231 | 248 | "name": "Read IOPS",
|
232 | 249 | "type": "number",
|
233 |
| - "jsonPath": ".status.result.readIops", |
| 250 | + "jsonPath": ".status.readIopsResult", |
234 | 251 | },
|
235 | 252 | {
|
236 | 253 | "name": "Write Bandwidth",
|
237 |
| - "type": "number", |
238 |
| - "jsonPath": ".status.result.writeBw", |
| 254 | + "type": "string", |
| 255 | + "jsonPath": ".status.writeBwResult", |
239 | 256 | },
|
240 | 257 | {
|
241 | 258 | "name": "Write IOPS",
|
242 | 259 | "type": "number",
|
243 |
| - "jsonPath": ".status.result.writeIops", |
| 260 | + "jsonPath": ".status.writeIopsResult", |
244 | 261 | }
|
245 | 262 | ]
|
246 | 263 | ):
|
@@ -288,6 +305,13 @@ def summarise(self):
|
288 | 305 | else:
|
289 | 306 | aggregate_data = [i for i in fio_json['client_stats'] if i['jobname'] == 'All clients'][0]
|
290 | 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) |
| 313 | + |
| 314 | + # Use unformatted data for full fioresult |
291 | 315 | self.status.result = FioResult(
|
292 | 316 | read_bw = aggregate_data['read']['bw'],
|
293 | 317 | read_iops = aggregate_data['read']['iops'],
|
|
0 commit comments