Skip to content

Commit c23c055

Browse files
committed
[pcp_metrics] Skip malformed annotation lines
So now we're skipping lines that doesn't match the expected format of: TIMESTAMP | Details So any log line like: " - PLAY [Manage and Provide ironic baremetal nodes] stdout: "[WARNING]: Found variable using reserved name: namespace\n\n" should not be parsed and then not making a runtime Error. Signed-off-by: Enrique Vallespi Gil <[email protected]>
1 parent b9f05e2 commit c23c055

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

roles/pcp_metrics/files/plot.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -410,7 +410,10 @@ def annotate(axs: Iterable[plt.Axes]) -> None:
410410
data = file.read().strip().split("\n")
411411

412412
for annotation in data:
413-
time, details = annotation.split(" | ", maxsplit=1)
413+
try:
414+
time, details = annotation.split(" | ", maxsplit=1)
415+
except ValueError:
416+
print("WARNING Skipping malformed annotation line:", annotation.strip())
414417
time = datetime.strptime(time, "%Y-%m-%d %H:%M:%S,%f")
415418

416419
if details.startswith("PLAY"):

0 commit comments

Comments
 (0)