[New-bugs-announce] [issue24767] can concurrent.futures len(Executor) return the number of tasks?

Pat Riehecky report at bugs.python.org
Fri Jul 31 21:55:13 CEST 2015


New submission from Pat Riehecky:

As a feature request, can the Executor respond to a len() request by showing the number of non-finished/non-canceled items in the pool?

I would like a clean pythonic way of seeing how many items remain to be executed and this seemed the way to go.

psudo-code:

    myvar = list(range(1, 30))

    pool = concurrent.futures.ThreadPoolExecutor(max_workers=2)
    results = pool.map(myfunction, myvar)

    for result in results:
        print("waiting for " + str(len(pool)) + " tasks to finish")

----------
components: Library (Lib)
messages: 247766
nosy: Pat Riehecky
priority: normal
severity: normal
status: open
title: can concurrent.futures len(Executor) return the number of tasks?
type: enhancement
versions: Python 3.4

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue24767>
_______________________________________


More information about the New-bugs-announce mailing list