Skip to content

Commit 2c87813

Browse files
committed
Add counter for nudge attempts
1 parent 9770ef7 commit 2c87813

File tree

1 file changed

+7
-5
lines changed

1 file changed

+7
-5
lines changed

notebook/services/kernels/handlers.py

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,13 +176,15 @@ def on_timeout():
176176
loop = IOLoop.current()
177177

178178
# Nudge the kernel with kernel info requests until we get an IOPub message
179-
def nudge():
180-
self.log.debug("Nudge")
179+
def nudge(count):
180+
count += 1
181181
if not future.done():
182-
self.log.debug("nudging")
182+
self.log.debug("Nudging attempt %s or kernel %s" % (count, self.kernel_id))
183183
self.session.send(shell_channel, "kernel_info_request")
184-
nudge_handle = loop.call_later(0.5, nudge)
185-
nudge_handle = loop.call_later(0, nudge)
184+
nudge_handle = loop.call_later(0.5, nudge, count)
185+
186+
nudge_count = 0
187+
nudge_handle = loop.call_later(0, nudge, nudge_count)
186188

187189
timeout = loop.add_timeout(loop.time() + self.kernel_info_timeout, on_timeout)
188190
return future

0 commit comments

Comments
 (0)