Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

allow disabling offline message buffering#2916

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
takluyver merged 1 commit intojupyter:masterfromminrk:allow-disable-buffering
Oct 20, 2017
Merged
Changes fromall commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
allow disabling offline message buffering
escape hatch if the new buffering is causing anyone trouble
  • Loading branch information
@minrk
minrk committedOct 10, 2017
commite4186c47c06740aa7e18e9de97b175b62a615dc9
22 changes: 19 additions & 3 deletionsnotebook/services/kernels/kernelmanager.py
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -83,6 +83,17 @@ def _update_root_dir(self, proposal):
Only effective if cull_idle_timeout is not 0."""
)

buffer_offline_messages = Bool(True, config=True,
help="""Whether messages from kernels whose frontends have disconnected should be buffered in-memory.

When True (default), messages are buffered and replayed on reconnect,
avoiding lost messages due to interrupted connectivity.

Disable if long-running kernels will produce too much output while
no frontends are connected.
"""
)

_kernel_buffers = Any()
@default('_kernel_buffers')
def _default_kernel_buffers(self):
Expand All@@ -105,7 +116,7 @@ def cwd_for_path(self, path):
while not os.path.isdir(os_path) and os_path != self.root_dir:
os_path = os.path.dirname(os_path)
return os_path

@gen.coroutine
def start_kernel(self, kernel_id=None, path=None, **kwargs):
"""Start a kernel for a session and return its kernel_id.
Expand DownExpand Up@@ -148,7 +159,7 @@ def start_kernel(self, kernel_id=None, path=None, **kwargs):

# py2-compat
raise gen.Return(kernel_id)

def start_buffering(self, kernel_id, session_key, channels):
"""Start buffering messages for a kernel

Expand All@@ -163,6 +174,12 @@ def start_buffering(self, kernel_id, session_key, channels):
channels: dict({'channel': ZMQStream})
The zmq channels whose messages should be buffered.
"""

if not self.buffer_offline_messages:
for channel, stream in channels.items():
stream.close()
return

self.log.info("Starting buffering for %s", session_key)
self._check_kernel_id(kernel_id)
# clear previous buffering state
Expand All@@ -182,7 +199,6 @@ def buffer_msg(channel, msg_parts):
for channel, stream in channels.items():
stream.on_recv(partial(buffer_msg, channel))


def get_buffer(self, kernel_id, session_key):
"""Get the buffer for a given kernel

Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp