Commit graph

26 commits

Author SHA1 Message Date
Nathaniel Nicandro
a1caa15244 Hot load correct jupyter-kernel implementation in the default one
That is, ensure the `jupyter-kernel` implementation that can handle
the keywords provided in a call to the default implementation has its
definition loaded so that another dispatch to `jupyter-kernel` will
use it.
2023-02-13 20:30:19 -06:00
Nathaniel Nicandro
86beb065db jupyter-kernel: Move conn-info key handling to "process" :extra method 2023-02-13 20:30:19 -06:00
Nathaniel Nicandro
a69242eda9 Add TODO 2023-02-13 20:30:19 -06:00
Nathaniel Nicandro
f92e14f62b Add jupyter-restart-kernel 2023-02-13 20:25:05 -06:00
Nathaniel Nicandro
31d79dfd84 Remove do prefix of kernel action functions 2023-02-13 20:25:05 -06:00
Nathaniel Nicandro
ef26ef1b08 Remove jupyter-io 2023-02-13 20:25:05 -06:00
Nathaniel Nicandro
f4df7d98e1 Add jupyter-kernel-name 2023-02-13 20:25:05 -06:00
Nathaniel Nicandro
79500c010e Remove old default kernel interrupt implementation 2023-02-13 20:25:05 -06:00
Nathaniel Nicandro
e133c34707 Add do prefix to launch,shutdown,interrupt functions of a kernel
launch,shutdown,interrupt are now monadic functions.
2023-02-13 20:22:50 -06:00
Nathaniel Nicandro
155f421aed jupyter-io definition of jupyter-kernel 2023-02-13 20:22:50 -06:00
Nathaniel Nicandro
7346571275 Discard I/O connection on shutdown 2023-02-13 20:22:50 -06:00
Nathaniel Nicandro
3a3bfcc631 Simplify jupyter-restart
No need to do anything about client connections here.  Leave that up
to the kernel implementations.
2023-02-13 20:22:49 -06:00
Nathaniel Nicandro
66ee784b22 Fix typo 2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
4c41ea176f Use an extra jupyter-shutdown method to stop a kernel's IO 2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
3e40fde7ec Replacement for jupyter-conn-id 2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
58f281c7fc Remove conn slot of a client and clients slot of a kernel 2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
55009e3a0d Use jupyter-session-endpoints in one place 2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
31f0ef4f93 Add jupyter--kernel-connection
Also tidy up `jupyter-connection`
2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
e111aba096 Move jupyter-(dis)?connect into the jupyter-connection interface
The former pair of methods were only used to connect clients and
kernels.
2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
348df7feb5 Remove jupyter-send-* methods
These methods were not used much internally.
2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
b814e05223 Formalize jupyter-disconnect and jupyter-connect 2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
f2c9d5fb25 Convert jupyter-kernel into a method
* jupyter-kernel-process.el
* jupyter-server-kernel.el (jupyter-kernel): New method.

* jupyter-kernel.el (jupyter-kernel): Convert.  Load files that handle
  keywords and re-dispatch when ARGS does not have any connection
  info.  Document behavior.

* test/test-helper.el (jupyter-test-with-kernel-client)
* jupyter-server.el
(jupyter-connect-server-repl)
(jupyter-server-start-new-kernel): Use `jupyter-kernel`.
2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
a33231b4d3 Rename many methods 2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
790a29fe5d Reconnect clients after kernel restart 2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
bdb8488bf3 Remove comm-layer and related
Remove `jupyter-channel-ioloop-comm.el`, `jupyter-comm-layer.el`, `jupyter-ioloop-comm.el`.
Remove the kcomm slot of a client, replace it with a kernel slot.
jupyter-server.el: Remove kernel communication related code.
Remove `jupyter-kernel-lifetime`.

* jupyter-kernel-manager.el (jupyter-kernel-lifetime): Do it. Update
  all subclasses. All methods it defined no longer take a type.  This
  is in preparation of removing most of them altogether.
(jupyter-kernel-manager): Update doc.

* jupyter-kernel-process-manager.el
(jupyter-kernel-process): Update documentation.
(jupyter--kernel-died-process-sentinel): Remove type check.

* test/jupyter-test.el (jupyter-local-tcp-conn-info): Remove.
(jupyter-kernel-lifetime): Remove.

[conn] Have `jupyter-kernel-manager.el` re-direct to the new interface

* jupyter-kernel-manager.el
(jupyter-kernel-alive-p): Check that the kernel is
live, not an Emacs connection to it.
(jupyter-start-kernel)
[jupyter-kernel, jupyter-kernel-manager]: Use `jupyter-launch`.
(jupyter-shutdown-kernel) [jupyter-kernel-manager]: Use `jupyer-shutdown`.
(jupyter-kill-kernel) [jupyter-kernel]: Ditto. Remove a method
definition.
(jupyter-make-client): Use `jupyter-client`.
(jupyter-interrupt-kernel) [jupyter-kernel-manager]: Use `jupyer-interrupt`.

* jupyter-kernel-process-manager.el: Remove.

Don't add finalizer to cleanup process.

Cleanup is done in other ways, e.g. in
`jupyter--gc-kernel-processes`.  Also it doesn't make sense to delete
a general kernel because the object that represents it in Emacs is no
longer accessible.
2023-02-13 20:21:14 -06:00
Nathaniel Nicandro
95f3e150b4 Add jupyter-kernel.el and related
The new files added in this commit will eventually replace the manager
and kernel classes and favor struct types to represent kernels instead
of classes.  A kernel manager was a concept ripped from the
jupyter/jupyter_client reference implementation.

In Emacs the concept makes the client implementation more complicated
and is replaced by functions that manage the lifetime of a kernel:
`jupyter-launch`, `jupyter-shutdown`, and `jupyter-interrupt`.

* jupyter-kernel-manager.el
* jupyter-kernel-process-manager.el
* jupyter-server.el
* test/jupyter-server-test.el
* test/test-helper.el: Make `jupyter-kernel`, `jupyter-server-kernel`,
  and `jupyter-kernel-process` private classes.  The new files below
  use the public names, but as structs now.

* jupyter-kernel.el
* jupyter-kernel-process.el
* jupyter-server-kernel.el: New files.
2023-02-13 20:21:14 -06:00