Running this code, I get the following log and instead of future value, I get thread object. What is the right way to yield for result of f and finally return Y with values ?
Y = []
process_pool = ThreadPoolExecutor(4)
f = partial(some_func, *args)
for i in range(1000):
future = process_pool.submit( f ,i)
print(future)
Y.append(future)
return Y
log:
<Future at 0x7f82c8ebf390 state=running>
<Future at 0x7f82cb636f10 state=running>
<Future at 0x7f82cb0af090 state=running>
<Future at 0x7f82cb0af190 state=running>
<Future at 0x7f82cb0af350 state=pending>
<Future at 0x7f82cb0ae350 state=pending>
...
Y:
[<Future at 0x7f82c8ebf390 state=finished raised NameError>, <Future at 0x7f82cb636f10 state=finished raised NameError>, <Future at 0x7f82cb0af090 state=finished raised NameError>, <Future at 0x7f82cb0af190 state=finished raised NameError>, <Future at 0x7f82cb0af350 state=finished raised NameError>, <Future at 0x7f82cb0ae350 state=finished raised NameError>, <Future at 0x7f82cb0ae290 state=running>, <Future at 0x7f82cb0aea10 state=finished raised NameError>, <Future at 0x7f82cb0ae950 state=running>,...]