Skip to contentSkip to conversation

toaster.bbclass: fix TypeError when parsing build stats

PATCH New Elliot Smith 1 participant 1 message Dec 22, 2015

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 toaster.bbclass: fix TypeError when parsing build stats

Reading IO stats fails because the IO read/write bytes are being converted to strings, then added to a numeric running total.

Fix this by converting IO stats to integers.

---
 meta/classes/toaster.bbclass | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
meta/classes/toaster.bbclass +2 -2
index 4fb52a9..bbda2f8 100644
@@ -212,10 +212,10 @@ python toaster_collect_task_stats() {
             cpu_usage = str(statinfo["CPU usage"]).strip('% \n\r')
 
         if "IO write_bytes" in statinfo:
-            disk_io = disk_io + str(statinfo["IO write_bytes"]).strip('% \n\r')
+            disk_io = disk_io + int(statinfo["IO write_bytes"].strip('% \n\r'))
 
         if "IO read_bytes" in statinfo:
-            disk_io = disk_io + str(statinfo["IO read_bytes"]).strip('% \n\r')
+            disk_io = disk_io + int(statinfo["IO read_bytes"].strip('% \n\r'))
 
         if "Started" in statinfo:
             started = str(statinfo["Started"]).strip('% \n\r')
Signature · 12 lines
1.9.3

---------------------------------------------------------------------
Intel Corporation (UK) Limited
Registered No. 1134945 (England)
Registered Office: Pipers Way, Swindon SN3 1RJ
VAT No: 860 2173 47

This e-mail and any attachments may contain confidential material for
the sole use of the intended recipient(s). Any review or distribution
by others is strictly prohibited. If you are not the intended
recipient, please contact the sender and delete all copies.