Commit graph

44 commits

Author SHA1 Message Date
Nathaniel Nicandro
aa054178b7 Refactor jupyter-start-new-kernel 2018-02-03 19:06:10 -06:00
Nathaniel Nicandro
43a59ba74d Update channel implementation
- Distinguish between an asynchronous channel and a synchronous one

  - `jupyter-async-channel` :: Messages are sent and received through an ioloop
                               subprocess that the channel has access to. The
                               subprocess uses the `jupyter-sync-channel` for
                               sending and receiving messages.

  - `jupyter-sync-channel` :: Messages are sent and received through a
                               `zmq-socket` in the current Emacs session.

  - Define `jupyter-send` and `jupyter-recv` methods for channels.

  - Update `jupyter-kernel-client` and ioloop interfaces to take into account
    changes with channels.
2018-02-03 19:06:10 -06:00
Nathaniel Nicandro
0504bf36e0 Update documentation and comments 2018-02-03 19:06:10 -06:00
Nathaniel Nicandro
341214f5a9 Add documentation 2018-01-22 19:21:44 -06:00
Nathaniel Nicandro
51e48545a6 Fix use of progress reporter 2018-01-22 18:36:00 -06:00
Nathaniel Nicandro
c7a4874222 Only attempt to start a kernel when it is not already started 2018-01-22 18:35:25 -06:00
Nathaniel Nicandro
d41751575a Re-emit error when kernel fails to start 2018-01-21 01:06:29 -06:00
Nathaniel Nicandro
7267577de0 Take into account changes in kernelspec code 2018-01-20 23:13:04 -06:00
Nathaniel Nicandro
43d5d4a8c9 Use cl-defgeneric for jupyter-kernel-manager methods
Also cleanup documentation
2018-01-18 23:00:31 -06:00
Nathaniel Nicandro
6934118012 Add progress reporters when starting a kernel 2018-01-18 22:47:18 -06:00
Nathaniel Nicandro
de635fdc3a Add customizable jupyter-runtime-directory variable
- Also fix the handling of `resource_dir` in a kernelspec argument vector
2018-01-18 22:45:17 -06:00
Nathaniel Nicandro
f27fad472b Add documentation to jupyter-kernel-manager slots 2018-01-18 22:43:52 -06:00
Nathaniel Nicandro
fc052d3baf jupyter-connection objects have a kernel-info slot
This allows the kernel info to be shared between a kernel manager and the
clients that have the manager as its parent instance.
2018-01-18 21:14:27 -06:00
Nathaniel Nicandro
e457ecbfa7 Add object destructors for jupyter-kernel-manager and jupyter-kernel-client
These are used when an object definately needs to be destroyed. They are needed
to cleanup resources like processes and internal buffers.
2018-01-18 16:06:22 -06:00
Nathaniel Nicandro
d0257740bb Simplify variable names 2018-01-17 20:37:34 -06:00
Nathaniel Nicandro
e4c3088749 Add jupyter-inhibit-handlers
This removes the need for `jupyter-request-inhibit-handlers`
2018-01-17 20:34:32 -06:00
Nathaniel Nicandro
f302445ac2 Handle more failure cases when starting a new kernel 2018-01-16 11:52:26 -06:00
Nathaniel Nicandro
9b66532f94 Use message instead of warn 2018-01-16 11:52:10 -06:00
Nathaniel Nicandro
5864e855e3 Add a buffer to the kernel process
This allows for looking at the kernel stdout
2018-01-16 11:51:16 -06:00
Nathaniel Nicandro
20f9ea2643 Do proper cleanup when kernel startup fails
- `jupyter-shutdown-kernel` assumes that the kernel is able to be communicated
  with, but when startup fails we know its not so just delete the process
  immediately.

- When deleting the connection info file after a kernel dies, make sure that
  the file exists first.
2018-01-14 13:54:02 -06:00
Nathaniel Nicandro
fd89b419a7 Better predicate in jupyter-kernel-alive-p 2018-01-13 22:11:09 -06:00
Nathaniel Nicandro
060340625e Properly cleanup if jupyter-start-kernel fails in jupyter-start-new-kernel 2018-01-13 22:10:38 -06:00
Nathaniel Nicandro
3e57114a18 Code style and remove completed TODO 2018-01-13 22:10:18 -06:00
Nathaniel Nicandro
dc4c9f7a66 Allow restarting the kernel after shutdown in jupyter-shutdown-kernel 2018-01-13 22:08:14 -06:00
Nathaniel Nicandro
80dd6a51e8 Fix jupyter--kernel-sentinel
- `jupyter-stop-channels` is already called in `jupyter-shutdown-kernel`
- Don't delete connection info when kernel dies because it can be restarted.
2018-01-13 22:06:41 -06:00
Nathaniel Nicandro
865db23f28 Set the process sentinel in jupyter--start-kernel 2018-01-13 22:04:06 -06:00
Nathaniel Nicandro
710d4125b5 Update documentation and comments 2018-01-13 13:40:32 -06:00
Nathaniel Nicandro
d67883d9f5 Use unwind-protect instead of condition-case 2018-01-13 13:36:15 -06:00
Nathaniel Nicandro
a5d188e32f Move jupyter-wait-until-startup to jupyter-kernel-manager.el
Also make `jupyter-wait-until-startup` private by renaming to
`jupyter--wait-until-startup`. Startup messages are only sent once at kernel
startup, since the only way to start a kernel is through a
`jupyter-kernel-manager` it makes more sense to only allow a kernel manager to
wait for a startup message.
2018-01-12 18:14:04 -06:00
Nathaniel Nicandro
1760d4942b Remove unused variable 2018-01-12 18:10:11 -06:00
Nathaniel Nicandro
ce9321be09 Add timeout when starting a kernel 2018-01-12 18:09:30 -06:00
Nathaniel Nicandro
af82c55b1c Introduce jupyter-wait-until-startup 2018-01-11 12:14:35 -06:00
Nathaniel Nicandro
c86ab40514 Fix no method found error in jupyter-shutdown-kernel 2018-01-11 12:13:33 -06:00
Nathaniel Nicandro
a7539dc37b Fix checkdoc warnings 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
c7dee4aa55 Simplify kernel shutdown and interruptions in a kernel manager 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
d44d9d0c64 Actually set the kernel process of a manager when starting the kernel 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
14e02c95bf Handle {resource_dir} when starting kernel 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
326ff15d92 Add standard header comments 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
ebd616998e Add/update lots of documentation 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
6178a53638 Refactor jupyter-start-new-kernel to use jupyter-missing-request 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
c500b08104 Set default values for the jupyter-connection slots of a jupyter-kernel-manager 2018-01-09 00:44:33 -06:00
Nathaniel Nicandro
71c4314a86 jupyter-connection inherits from eieio-instance-inheritor
This way when creating kernel clients with `jupyter-kernel-manager`, we can set
the `parent-instance` of the newly created client to the manager thereby
inheriting the `jupyter-session` from the kernel manager.

Also have `jupyter-channel` objects inherit from a `jupyter-connection` so that
we can define `jupyter-send` and `jupyter-recv` methods for channels in the future.
2018-01-07 14:53:12 -06:00
Nathaniel Nicandro
312f8d5ce8 Refactor the kernel initialization process in jupyter-kernel-manager
Also add `jupyter-start-new-kernel` which starts a kernel and initializes a
client connected to the kernel.
2018-01-06 19:56:56 -06:00
Nathaniel Nicandro
b3b1066624 Re-organization of code base
- `jupyter-client.el` only contains client related code

- `jupyter-kernel-manager` related code is placed in `jupyter-kernel-manager.el`

- Socket creating functions and generating connection info plist function are
  placed in `jupyter-connection.el`. This also contains the
  `jupyter-connection` class.

- Kernelspec related functions are placed in `jupyter-kernelspec.el`

- Move general utility functions and variables requires necessary for `jupyter`
  into `jupyter-base.el`. This also contains the `jupyter-session` and
  `jupyter-request` struct definitions.
2018-01-06 19:55:45 -06:00