-
-
Notifications
You must be signed in to change notification settings - Fork 373
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
clean exit from eventloops #290
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
takluyver
reviewed
Dec 15, 2017
ipykernel/_eventloop_macos.py
Outdated
Calls NSApp / CoreFoundation APIs via ctypes. | ||
""" | ||
|
||
# cribbed heavily from IPython.terminal.pt_importhooks.osx |
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.
importhooks -> inputhooks
Removes reliance on matplotlib for Cocoa eventloop integration mostly copied from pt_inputhooks/osx, with changed wake logic: - wake on timer instead of stdin FD - fix stopping of CFRunLoop when no NSApp is running
minrk
force-pushed
the
asyncio-clean-exit
branch
from
December 15, 2017 13:26
094d7d8
to
c2f90ec
Compare
takluyver
approved these changes
Dec 15, 2017
Thanks, it seems to fix the specific issue raised in #274. however, restarting a kernel with this still takes a very long time: import concurrent.futures
import asyncio
executor = concurrent.futures.ProcessPoolExecutor()
ioloop = asyncio.get_event_loop()
def simple_function(x):
import time
time.sleep(10000)
return x
tsk = ioloop.run_in_executor(executor, simple_function, 0) |
Carreau
approved these changes
Dec 15, 2017
Thanks! |
@basnijholt let's investigate slow restart in a separate Issue. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When any eventloop is running, ipykernel doesn't exit cleanly because we don't stop the main eventloop, we just stop tornado, which isn't running anymore when the eventloop is active. It turns out we have been relying on jupyter-client forcibly terminating kernels that don't shutdown promptly after a polite request.
To solve this, eventloop.exit_hook is added and should be called when exit is requested (the same event where we have been stopping tornado should now stop both eventloops if they are running).
closes #274
closes #282
TODO:
cc @jbweston and @basnijholt for testing