[Git][NTPsec/ntpsec][master] ntpclients/ntpviz.py: Better handle bad data in peerstats file.

Gary E. Miller (@garyedmundsmiller) gitlab at mg.gitlab.com
Wed Dec 1 20:15:13 UTC 2021



Gary E. Miller pushed to branch master at NTPsec / ntpsec


Commits:
5c423250 by Gary E. Miller at 2021-12-01T12:14:45-08:00
ntpclients/ntpviz.py: Better handle bad data in peerstats file.

- - - - -


1 changed file:

- ntpclients/ntpviz.py


Changes:

=====================================
ntpclients/ntpviz.py
=====================================
@@ -479,8 +479,8 @@ set rmargin 10
         if item2:
             for row in rows:
                 try:
-                    values1.append(float(row[item1]))
-                    values2.append(float(row[item2]))
+                    val1 = float(row[item1])
+                    val2 = float(row[item2])
                     if 2200000 < row[0] - last_time:
                         # more than 2,200 seconds between points
                         # data loss, add a break in the plot line
@@ -491,6 +491,10 @@ set rmargin 10
                     last_time = row[0]
                 except IndexError:
                     pass
+                except ValueError:
+                    pass
+                values1.append(val1)
+                values2.append(val2)
         else:
             for row in rows:
                 try:
@@ -504,6 +508,8 @@ set rmargin 10
                     last_time = row[0]
                 except IndexError:
                     pass
+                except ValueError:
+                    pass
 
         # I know you want to replace the plot_data string concat with
         # or more join()s, do not do it, it is slower



View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/5c423250b7049653b8fc212729a9d0e19bbf777d

-- 
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/-/commit/5c423250b7049653b8fc212729a9d0e19bbf777d
You're receiving this email because of your account on gitlab.com.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20211201/ae4a5483/attachment-0001.htm>


More information about the vc mailing list