Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pass loop attribute to asyncio.ensure_future #1

Merged
merged 1 commit into from
Dec 7, 2020

Conversation

max-k
Copy link

@max-k max-k commented Dec 1, 2020

If we specify a custom event loop at worker instantiation, it has to also be used by asyncio instead of default one.

Description

In some situation (for example in integration tests of Faust agents), I have to retry worker startup because kafka is not yet available.

But the first time I run execute_from_commandline, the default event loop is closed so I have to create a new one before calling execute_from_commandline again.

Unfortunately, custom event loop is not properly transmitted to asyncio, so it automatically makes use of default event loop and raise a RuntimeError('Event loop is closed').

With this simple fix, user-specified event loop will be properly transmitted to asyncio.

If we specify a custom event loop at worker instantiation, it has to also be used by asyncio instead of default one.
Copy link

@patkivikram patkivikram left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do we plan on releasing this in pypi? Maybe call it mode-steaming?

@max-k
Copy link
Author

max-k commented Dec 7, 2020

Hi.

It's exactly the question I asked in the issue related to mode on faust-streaming project :-)
faust-streaming/faust#43 (comment)
mode-streaming is okay for me.

@patkivikram patkivikram merged commit ff236d1 into faust-streaming:master Dec 7, 2020
@max-k max-k deleted the fix_loop_management branch December 7, 2020 14:54
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants