-
Notifications
You must be signed in to change notification settings - Fork 152
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
Create new eventloop to run coroutines #1055
Conversation
@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
I will add a test to iterate over two asyncio DataPipe at the same time to make sure it works. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
@ejguan has imported this pull request. If you are a Meta employee, you can view this diff on Phabricator. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM! This should fix the situation where asyncio.run()
function cannot be called when another asyncio
event loop is running in the same thread, such as in Jupyter notebook.
Non-blocking, it would be nice if we have some tests related to that.
I just looked deeper on In thoery, users should never make DataLoader2 inside a |
@NivekT also suggests to capture the exception to raise suggestion for users who want to use it in notebook. |
Prevent calling
asyncio.run
within__iter__
function. New event loop would be created rather than reusing the global event loop.Using policy for the case of custom policy is used as suggested in https://docs.python.org/3.8/library/asyncio-eventloop.html#event-loop
Address the comment