noxdafox / pebble

Multi threading and processing eye-candy.
GNU Lesser General Public License v3.0
536 stars 52 forks source link

@concurrent.process returned future blocks/hangs on running(), cancelled(), done() calls #116

Closed bitsofinfo closed 1 year ago

bitsofinfo commented 1 year ago

Hi- thanks for this library.

Trying to understand something. In my program I have a function such as


async def processor(something):
   # do some intensive work that calls more async code

@concurrent.process
def do(something):
    asyncio.run(processor(something))

def whatever():
    for x in somethings:
        f = do(x)
        print(f.running())

What I am noticing is that the call to f.running() just hangs.... shouldn't that immediately return true or false?

bitsofinfo commented 1 year ago

also its not just running, but all the others as well. I thought only result() would block

noxdafox commented 1 year ago

Mixing multiprocessing and asyncio requires a certain degree of knowledge on how the two fundamentally work.

I would recommend to first read the documentation in merit and understand what can and cannot be done when mixing asyncio and multiprocessing.

This issue has nothing to do with Pebble itself.

Please do not use GitHub issues for guidance. There are other places such as Stackoverflow for that.