From 728da16cad3611634957697dda87760af8c8aaf5 Mon Sep 17 00:00:00 2001 From: Stefan Huber Date: Thu, 9 May 2013 17:34:08 +0200 Subject: [PATCH] fix div by zero --- paralleljobs.py | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/paralleljobs.py b/paralleljobs.py index 535921c..465efdf 100755 --- a/paralleljobs.py +++ b/paralleljobs.py @@ -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)) -- 2.39.5