Skip to content

No daemon patch doesn't work in python 3.8

This gives a problem in python 3.8.5

from multiprocessing.pool import Pool as _Pool

class Pool(_Pool):
    Process = NoDaemonProcess

Failure:

================================================ test session starts ================================================
platform linux -- Python 3.8.5, pytest-6.2.2, py-1.10.0, pluggy-0.13.1
rootdir: /home/denolf/dev/pypushflow
plugins: anyio-2.2.0
collected 13 items                                                                                                  

pypushflow/test/test_Actors.py F

===================================================== FAILURES ======================================================
_________________________________________ TestPythonActor.test_ErrorHandler _________________________________________

self = <pypushflow.test.test_Actors.TestPythonActor testMethod=test_ErrorHandler>

    def test_ErrorHandler(self):
        script = "pypushflow.test.pythonErrorHandlerTest.py"
        name = "Python Error Handler Test"
        actor = PythonActor(script=script, name=name)
        errorHandler = ErrorHandler(name="Error handler")
        stopActor = StopActor()
        inData = {"name": "Ragnar"}
        actor.connect(stopActor)
        actor.connectOnError(errorHandler)
        errorHandler.connect(stopActor)
>       actor.trigger((None, inData))

pypushflow/test/test_Actors.py:65: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
pypushflow/PythonActor.py:259: in trigger
    self.async_factory = AsyncFactory(
pypushflow/PythonActor.py:126: in __init__
    self.pool = Pool(1)
/users/denolf/.pyenv/ubuntu_20_04/versions/3.8.5/lib/python3.8/multiprocessing/pool.py:212: in __init__
    self._repopulate_pool()
/users/denolf/.pyenv/ubuntu_20_04/versions/3.8.5/lib/python3.8/multiprocessing/pool.py:303: in _repopulate_pool
    return self._repopulate_pool_static(self._ctx, self.Process,
/users/denolf/.pyenv/ubuntu_20_04/versions/3.8.5/lib/python3.8/multiprocessing/pool.py:319: in _repopulate_pool_static
    w = Process(ctx, target=worker,
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _

self = <[AttributeError("'NoDaemonProcess' object has no attribute '_closed'") raised in repr()] NoDaemonProcess object at 0x7f9729575be0>
group = <multiprocessing.context.ForkContext object at 0x7f97295ea6a0>, target = <function worker at 0x7f972959b3a0>
name = None
args = (<multiprocessing.queues.SimpleQueue object at 0x7f9729569490>, <multiprocessing.queues.SimpleQueue object at 0x7f9729575910>, None, (), None, True)
kwargs = {}

    def __init__(self, group=None, target=None, name=None, args=(), kwargs={},
                 *, daemon=None):
>       assert group is None, 'group argument must be None for now'
E       AssertionError: group argument must be None for now

/users/denolf/.pyenv/ubuntu_20_04/versions/3.8.5/lib/python3.8/multiprocessing/process.py:82: AssertionError
============================================== short test summary info ==============================================
FAILED pypushflow/test/test_Actors.py::TestPythonActor::test_ErrorHandler - AssertionError: group argument must be...
!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! stopping after 1 failures !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
================================================= 1 failed in 0.18s =================================================