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

only consider stream output for data rate limit #2293

Merged
merged 2 commits into from Mar 22, 2017
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion notebook/notebookapp.py
Expand Up @@ -997,7 +997,7 @@ def _update_server_extensions(self, change):
limited.""")

iopub_data_rate_limit = Float(1000000, config=True, help="""(bytes/sec)
Maximum rate at which messages can be sent on iopub before they are
Maximum rate at which stream output can be sent on iopub before they are
limited.""")

rate_limit_window = Float(3, config=True, help="""(sec) Time window used to
Expand Down
19 changes: 16 additions & 3 deletions notebook/services/kernels/handlers.py
Expand Up @@ -336,7 +336,10 @@ def write_stderr(error_message):

# Increment the bytes and message count
self._iopub_window_msg_count += 1
byte_count = sum([len(x) for x in msg_list])
if msg_type == 'stream':
byte_count = sum([len(x) for x in msg_list])
else:
byte_count = 0
self._iopub_window_byte_count += byte_count

# Queue a removal of the byte and message count for a time in the
Expand All @@ -357,7 +360,12 @@ def write_stderr(error_message):
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_msg_rate_limit`."""))
`--NotebookApp.iopub_msg_rate_limit`.

Current values:
NotebookApp.iopub_msg_rate_limit={} (msgs/sec)
NotebookApp.rate_limit_window={} (secs)
""".format(self.iopub_msg_rate_limit, self.rate_limit_window)))
else:
# resume once we've got some headroom below the limit
if self._iopub_msgs_exceeded and msg_rate < (0.8 * self.iopub_msg_rate_limit):
Expand All @@ -374,7 +382,12 @@ def write_stderr(error_message):
The notebook server will temporarily stop sending output
to the client in order to avoid crashing it.
To change this limit, set the config variable
`--NotebookApp.iopub_data_rate_limit`."""))
`--NotebookApp.iopub_data_rate_limit`.

Current values:
NotebookApp.iopub_data_rate_limit={} (bytes/sec)
NotebookApp.rate_limit_window={} (secs)
""".format(self.iopub_data_rate_limit, self.rate_limit_window)))
else:
# resume once we've got some headroom below the limit
if self._iopub_data_exceeded and data_rate < (0.8 * self.iopub_data_rate_limit):
Expand Down