conkernelclient 0.0.10__tar.gz → 0.0.12__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conkernelclient
3
- Version: 0.0.10
3
+ Version: 0.0.12
4
4
  Summary: Concurrent-safe Jupyter KernelClient
5
5
  Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
6
6
  License: Apache-2.0
@@ -0,0 +1,2 @@
1
+ __version__ = "0.0.12"
2
+ from .core import *
@@ -1,4 +1,6 @@
1
- """Concurrent-safe Jupyter KernelClient"""
1
+ """Concurrent-safe Jupyter KernelClient
2
+
3
+ Docs: https://AnswerDotAI.github.io/conkernelclientcore.html.md"""
2
4
 
3
5
  # AUTOGENERATED! DO NOT EDIT! File to edit: ../nbs/00_core.ipynb.
4
6
 
@@ -30,12 +32,17 @@ def _send(self, stream, msg_or_type, content=None, parent=None, ident=None,
30
32
  buffers=None, track=False, header=None, metadata=None):
31
33
  msg = self._orig_send(stream, msg_or_type, content=content, parent=parent,
32
34
  ident=ident, buffers=buffers, track=track, header=header, metadata=metadata)
33
- # Force a sync, ensuring the send is fully registered internally
34
- # Avoids a race where the lock releases, another thread immediately calls send(),
35
- # and now 2 threads are interacting with the internal state before I/O thread has caught up
35
+ # Session.send sends via a SYNC shadow of the asyncio socket (zmq.Socket.shadow), which runs
36
+ # libzmq process_commands() and consumes the FD edge a buffered reply may have signalled —
37
+ # a recv parked in poll(None) on that edge would then sleep forever. Reading EVENTS through
38
+ # the async override (_AsyncSocket.get) makes pyzmq re-schedule _handle_events for pending
39
+ # recv/poll futures, compensating the consumed edge. It MUST be .get(): pyzmq aliases
40
+ # `getsockopt = SocketBase.get` at class level, so .getsockopt() bypasses the override
41
+ # and consumes the edge without rescheduling.
36
42
  if stream:
37
43
  if hasattr(stream, 'io_thread'): stream.io_thread.socket.get(zmq.EVENTS)
38
- elif hasattr(stream, 'getsockopt'): stream.getsockopt(zmq.EVENTS)
44
+ # See tests/zmq_regression.py for a regression test which fails is 'get' is switched to 'getsockopt'
45
+ elif hasattr(stream, 'get'): stream.get(zmq.EVENTS)
39
46
  return msg
40
47
 
41
48
  Session.send = _send
@@ -74,7 +81,6 @@ class ConKernelClient(AsyncKernelClient):
74
81
  q, soe = pend
75
82
  try: q.put_nowait(reply)
76
83
  except asyncio.QueueFull: pass
77
- else: _log.warning(f"Orphan reply for {reply['parent_header'].get('msg_id')}, pending={list(self._pending)}")
78
84
  cts = reply.get("content", {})
79
85
  if cts.get("status") in ("error", "aborted") and pend and soe:
80
86
  exc = RuntimeError(f"Kernel error aborted: {cts.get('ename')}: {cts.get('evalue')}")
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: conkernelclient
3
- Version: 0.0.10
3
+ Version: 0.0.12
4
4
  Summary: Concurrent-safe Jupyter KernelClient
5
5
  Author-email: Jeremy Howard <github@jhoward.fastmail.fm>
6
6
  License: Apache-2.0
@@ -39,5 +39,5 @@ version = {attr = "conkernelclient.__version__"}
39
39
  include = ["conkernelclient"]
40
40
 
41
41
  [tool.nbdev]
42
- allowed_metadata_keys = ['solveit_dialog_mode', 'solveit_ver']
43
- allowed_cell_metadata_keys = ["solveit_ai"]
42
+ allowed_metadata_keys = ['solveit']
43
+ allowed_cell_metadata_keys = ['solveit_ai']
@@ -1,2 +0,0 @@
1
- __version__ = "0.0.10"
2
- from .core import *