Skip to content

Commit de61e20

Browse files
authored
Merge pull request #2293 from minrk/stream-data-rate
only consider stream output for data rate limit
2 parents d1ad588 + 59c9df1 commit de61e20

File tree

2 files changed

+17
-4
lines changed

2 files changed

+17
-4
lines changed

notebook/notebookapp.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -997,7 +997,7 @@ def _update_server_extensions(self, change):
997997
limited.""")
998998

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

10031003
rate_limit_window = Float(3, config=True, help="""(sec) Time window used to

notebook/services/kernels/handlers.py

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -336,7 +336,10 @@ def write_stderr(error_message):
336336

337337
# Increment the bytes and message count
338338
self._iopub_window_msg_count += 1
339-
byte_count = sum([len(x) for x in msg_list])
339+
if msg_type == 'stream':
340+
byte_count = sum([len(x) for x in msg_list])
341+
else:
342+
byte_count = 0
340343
self._iopub_window_byte_count += byte_count
341344

342345
# Queue a removal of the byte and message count for a time in the
@@ -357,7 +360,12 @@ def write_stderr(error_message):
357360
The notebook server will temporarily stop sending output
358361
to the client in order to avoid crashing it.
359362
To change this limit, set the config variable
360-
`--NotebookApp.iopub_msg_rate_limit`."""))
363+
`--NotebookApp.iopub_msg_rate_limit`.
364+
365+
Current values:
366+
NotebookApp.iopub_msg_rate_limit={} (msgs/sec)
367+
NotebookApp.rate_limit_window={} (secs)
368+
""".format(self.iopub_msg_rate_limit, self.rate_limit_window)))
361369
else:
362370
# resume once we've got some headroom below the limit
363371
if self._iopub_msgs_exceeded and msg_rate < (0.8 * self.iopub_msg_rate_limit):
@@ -374,7 +382,12 @@ def write_stderr(error_message):
374382
The notebook server will temporarily stop sending output
375383
to the client in order to avoid crashing it.
376384
To change this limit, set the config variable
377-
`--NotebookApp.iopub_data_rate_limit`."""))
385+
`--NotebookApp.iopub_data_rate_limit`.
386+
387+
Current values:
388+
NotebookApp.iopub_data_rate_limit={} (bytes/sec)
389+
NotebookApp.rate_limit_window={} (secs)
390+
""".format(self.iopub_data_rate_limit, self.rate_limit_window)))
378391
else:
379392
# resume once we've got some headroom below the limit
380393
if self._iopub_data_exceeded and data_rate < (0.8 * self.iopub_data_rate_limit):

0 commit comments

Comments
 (0)