On 9 December 2016 at 21:25, Yury Selivanov <[email protected]> wrote:

>
> > On Dec 9, 2016, at 5:57 AM, Luca Sbardella <[email protected]>
> wrote:
> >
> > Hi,
> >
> > I'm trying to run pulsar in multiprocessing mode (using the
> multiprocessing module to create processes rather than asyncio subprocess).
> > However, in python 3.6 I have a small problem.
> > When the new process starts, it creates the event loop and starts it but
> I get
> >
> > raise RuntimeError('This event loop is already running')
> >
> > The loop is not running, but the _running_loop global in the
> asyncio.events module has been inherited from the master process and
> therefore the get_event_loop function is somehow broken.
> >
> > I resolved the issue via setting the running loop to None when the
> Process run method is called:
> >
> > def run(self):
> >     try:
> >         from asyncio.events import _set_running_loop
> >         _set_running_loop(None)
> >     except ImportError:
> >         pass
> >     ...
> >
> > Is that what I'm supposed to do? Or is there a better way?
>
> A better was is to never fork or spawn multiprocessing.Process from a
> running coroutine.


right, so if the forking is not in a coroutine it may work?!?!


>   Ideally, you want to stop the loop, spawn a process, resume the loop.
>

that does not sound what I should be doing, but I'll test it

Thanks


> Yury
>
>


-- 
http://lucasbardella.com

Reply via email to