From abdb7c692c12f85bec52270809cec3c7bea36e38 Mon Sep 17 00:00:00 2001 From: Ashwin Ramaswami Date: Wed, 1 Feb 2023 20:50:45 +0000 Subject: [PATCH] Fix division by zero error when time quota is set to 0 --- codalab/lib/formatting.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/codalab/lib/formatting.py b/codalab/lib/formatting.py index e1caabfdc..44f9f7f8c 100644 --- a/codalab/lib/formatting.py +++ b/codalab/lib/formatting.py @@ -102,7 +102,7 @@ def ratio_str(to_str, a, b): """ Example: to_str = duration_str, a = 60, b = 120 => "1m / 2m (50%)" """ - return '%s / %s (%.1f%%)' % (to_str(a), to_str(b), 100.0 * a / b) + return '%s / %s (%.1f%%)' % (to_str(a), to_str(b), 100.0 * a / b if b != 0 else 100.0) def parse_size(s):