Skip to content

Commit 63e58d0

Browse files
committed
add values_len function
1 parent 783c5b8 commit 63e58d0

File tree

1 file changed

+6
-1
lines changed

1 file changed

+6
-1
lines changed

reframe/frontend/executors/policies.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
# SPDX-License-Identifier: BSD-3-Clause
55

66
import contextlib
7+
import functools
78
import itertools
89
import math
910
import sys
@@ -17,6 +18,10 @@
1718
TaskEventListener, ABORT_REASONS)
1819

1920

21+
def values_len(d):
22+
return functools.reduce(lambda l, r: l + len(r), d.values(), 0)
23+
24+
2025
def _cleanup_all(tasks, *args, **kwargs):
2126
for task in tasks:
2227
if task.ref_count == 0:
@@ -417,7 +422,7 @@ def exit(self):
417422
num_polls = 0
418423
t_start = datetime.now()
419424
while (self._running_tasks or self._waiting_tasks or
420-
self._completed_tasks or sum(self._ready_tasks.values(), [])):
425+
self._completed_tasks or values_len(self._ready_tasks)):
421426
getlogger().debug('running tasks: %s' % len(self._running_tasks))
422427
num_polls += len(self._running_tasks)
423428
try:

0 commit comments

Comments
 (0)