diff --git a/reframe/frontend/executors/policies.py b/reframe/frontend/executors/policies.py index 83240978bd..83e5680a3c 100644 --- a/reframe/frontend/executors/policies.py +++ b/reframe/frontend/executors/policies.py @@ -4,6 +4,7 @@ # SPDX-License-Identifier: BSD-3-Clause import contextlib +import functools import itertools import math import sys @@ -17,6 +18,10 @@ TaskEventListener, ABORT_REASONS) +def dictlist_len(d): + return functools.reduce(lambda l, r: l + len(r), d.values(), 0) + + def _cleanup_all(tasks, *args, **kwargs): for task in tasks: if task.ref_count == 0: @@ -416,7 +421,8 @@ def exit(self): pollrate = PollRateFunction(0.2, 60) num_polls = 0 t_start = datetime.now() - while (self._running_tasks or self._waiting_tasks): + while (self._running_tasks or self._waiting_tasks or + self._completed_tasks or dictlist_len(self._ready_tasks)): getlogger().debug('running tasks: %s' % len(self._running_tasks)) num_polls += len(self._running_tasks) try: