Add jupyter-kernel-managers

This commit is contained in:
Nathaniel Nicandro 2019-06-25 09:33:08 -05:00
parent 25ff5dd871
commit b7a7c31422
2 changed files with 16 additions and 2 deletions

View file

@ -194,7 +194,7 @@ passed as the argument has a language of LANG."
(jupyter-stop-channels client)))))
(defun jupyter-clients ()
"Return a list of all `jupyter-kernel-clients'."
"Return a list of all `jupyter-kernel-client' objects."
(jupyter-all-objects 'jupyter--clients))
(defun jupyter-find-client-for-session (session-id)

View file

@ -258,7 +258,17 @@ argument of the process."
(unless (memq system-type '(ms-dos windows-nt cygwin))
(jupyter--block-until-conn-file-access atime kernel conn-file))))))
(defclass jupyter-kernel-manager (jupyter-kernel-lifetime)
(defvar jupyter--kernel-managers nil)
;; TODO: Move to generalize the kernel manager even more so it is independent
;; of a control channel and only relies mainly on the kernel and possibly some
;; other general object that can also be a control channel. This way we can
;; avoid this class.
(defclass jupyter-kernel-manager-base (jupyter-kernel-lifetime
jupyter-instance-tracker)
((tracking-symbol :initform 'jupyter--kernel-managers)))
(defclass jupyter-kernel-manager (jupyter-kernel-manager-base)
((kernel
:type jupyter-meta-kernel
:initarg :kernel
@ -268,6 +278,10 @@ argument of the process."
:initform nil
:documentation "The kernel's control channel.")))
(defun jupyter-kernel-managers ()
"Return a list of all `jupyter-kernel-manager' objects."
(jupyter-all-objects 'jupyter--kernel-managers))
(cl-defgeneric jupyter-make-client ((manager jupyter-kernel-manager) class &rest slots)
"Make a new client from CLASS connected to MANAGER's kernel.
SLOTS are the slots used to initialize the client with.")