Skip to content

Commit 32a94ef

Browse files
author
Vasileios Karakasis
authored
Merge pull request #2199 from rsarm/undefined-poll-rate
[bugfix] Fix division by zero when calculating the poll rate
2 parents 59217e7 + 1fef416 commit 32a94ef

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

reframe/frontend/executors/policies.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
import contextlib
77
import functools
88
import itertools
9+
import math
910
import sys
1011
import time
1112

@@ -63,9 +64,10 @@ def running_tasks(self, num_tasks):
6364
def snooze(self):
6465
t_elapsed = time.time() - self._t_init
6566
self._num_polls += 1
67+
poll_rate = self._num_polls / t_elapsed if t_elapsed else math.inf
6668
getlogger().debug2(
6769
f'Poll rate control: sleeping for {self._sleep_duration}s '
68-
f'(current poll rate: {self._num_polls/t_elapsed} polls/s)'
70+
f'(current poll rate: {poll_rate} polls/s)'
6971
)
7072
time.sleep(self._sleep_duration)
7173

0 commit comments

Comments
 (0)