]> git.sthu.org Git - paralleljobs.git/commitdiff
fix div by zero
authorStefan Huber <shuber@sthu.org>
Thu, 9 May 2013 15:34:08 +0000 (17:34 +0200)
committerStefan Huber <shuber@sthu.org>
Thu, 9 May 2013 15:34:08 +0000 (17:34 +0200)
paralleljobs.py

index 535921c758b70c6bd09707e05a50ff31cdd9281d..465efdf777622f4e215b42960606e3714af89d61 100755 (executable)
@@ -36,8 +36,12 @@ def printStatusInfo(conn):
 
     c.close()
 
-    perdone = 100.0*float(nodone)/float(nototal)
-    perwl = 100.0*float(wldone)/float(wltotal)
+    perdone = 0
+    perwl = 0
+    if nototal > 0:
+        perdone = 100.0*float(nodone)/float(nototal)
+    if wltotal > 0:
+        perwl = 100.0*float(wldone)/float(wltotal)
 
     print("%d (%.1f%%) of %d jobs and %.1f%% of the workload done. %d jobs are running." % \
             (nodone, perdone, nototal, perwl, nostarted-nodone))