From ce596c02666ea0a88e09a45866881c4cb4a8ff8f Mon Sep 17 00:00:00 2001 From: Raviv Pavel Date: Wed, 19 Jun 2019 11:40:27 +0300 Subject: [PATCH] Fix for division by zero in model download speed calculation --- trains/storage/helper.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/trains/storage/helper.py b/trains/storage/helper.py index b58db14b..9f909148 100644 --- a/trains/storage/helper.py +++ b/trains/storage/helper.py @@ -66,7 +66,8 @@ class _DownloadProgressReport(object): last_part = self.downloaded_mb - self.last_reported if self._verbose or (last_part >= self._report_chunk_size): - speed = last_part / (time() - self._tic) + time_diff = time() - self._tic + speed = (last_part / time_diff) if time_diff != 0 else 0 self._tic = time() self.last_reported = self.downloaded_mb self._log.info('Downloading: %.0fMB / %.2fMb @ %.2fMbs from %s' %