-
-
Notifications
You must be signed in to change notification settings - Fork 1.6k
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
PR: Fix conflict between AsyncDispatcher and run_sync
function of jupyter_core
#22137
PR: Fix conflict between AsyncDispatcher and run_sync
function of jupyter_core
#22137
Conversation
61c0ab9
to
ee4a2c5
Compare
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 @hlouzada for your work on this! I only left some formatting suggestions for you.
run_sync
function of jupyter_core
Gave this a check on Windows and got some different behaviors. In an old dev env I have I'm got a Traceback (most recent call last):
File "e:\acer\documentos\spyder\spyder otros\hlouzada\spyder\external-deps\qtconsole\qtconsole\manager.py", line 27, in poll
super().poll()
File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\site-packages\jupyter_client\restarter.py", line 121, in poll
if not self.kernel_manager.is_alive():
File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\site-packages\jupyter_core\utils\__init__.py", line 173, in wrapped
return loop.run_until_complete(inner)
File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\asyncio\base_events.py", line 625, in run_until_complete
self._check_running()
File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\asyncio\base_events.py", line 584, in _check_running
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running
Traceback (most recent call last):
File "e:\acer\documentos\spyder\spyder otros\hlouzada\spyder\external-deps\qtconsole\qtconsole\manager.py", line 27, in poll
super().poll()
File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\site-packages\jupyter_client\restarter.py", line 121, in poll
if not self.kernel_manager.is_alive():
File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\site-packages\jupyter_core\utils\__init__.py", line 173, in wrapped
return loop.run_until_complete(inner)
File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\asyncio\base_events.py", line 625, in run_until_complete
self._check_running()
File "C:\Users\dalth\anaconda3\envs\spyder-dev\lib\asyncio\base_events.py", line 584, in _check_running
raise RuntimeError('This event loop is already running')
RuntimeError: This event loop is already running However, in a newer env I got just the connection dialog showing that the connection errored (when using the container private ip): Checking the container files did a test using localhost/127.0.0.1 and the mapped port and I got a connection to be stablished but then all you see is the console restarting continuously: and for some reason from the cmd that I used to lauch Spyder seems like the script to install spyder on dev mode starts to run?: Also, after closing Spyder, I still got some output: so I had to interrupt things ( |
Thanks for the info @dalthviz, I'll take a look and get back to you. |
8996593
to
b14fd0a
Compare
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 @hlouzada!
Description of Changes
Allow AsyncDispatcher to get the "main thread" running loop without depending on
asyncio.set_event_loop
andasyncio.get_running_loop
so it won't trigger conflict with howjupyter_core.utils.run_sync
handles creating, setting and executing event loops.Also, refactor type hints to help with hinting decoreted async functions.
Affirmation
By submitting this Pull Request or typing my (user)name below,
I affirm the Developer Certificate of Origin
with respect to all commits and content included in this PR,
and understand I am releasing the same under Spyder's MIT (Expat) license.
I certify the above statement is true and correct:
@hlouzada