Commit graph

46 commits

Author SHA1 Message Date
Nathaniel Nicandro
becddfc9ea Fix requires
`jupyter-channels.el` depends on the `jupyter-send` method defined in
`jupyter-messages.el` whereas `jupyter-messages.el` does not depend on any
functions in `jupyter-channels.el`.

* jupyter-channel.el: Require `jupyter-messages`

* jupyter-messages.el: Remove `jupyter-channels` require
2018-11-08 21:30:32 -06:00
Nathaniel Nicandro
527c2ae859 Fix wrong variable name 2018-11-05 00:00:11 -06:00
Nathaniel Nicandro
8badade6d1 jupyter-hb-unpause: Set paused to nil when sending a ping is guaranteed 2018-11-01 01:56:59 -05:00
Nathaniel Nicandro
e929cffba1 jupyter-stop-channel: Group oref calls 2018-11-01 01:56:59 -05:00
Nathaniel Nicandro
2e97d8ce01 Remove code duplication when connecting heartbeat channels
* Add `jupyter-channel--reset-socket` which does the work of connecting the
  heartbeat channel to its endpoint and takes care of possibly reseting the
  socket after sending a ping.
2018-11-01 01:56:58 -05:00
Nathaniel Nicandro
e02bed9a50 Add jupyter-hb-consider-dead-periods 2018-10-25 23:17:27 -05:00
Nathaniel Nicandro
288fb17ece Update comments 2018-10-25 23:17:27 -05:00
Nathaniel Nicandro
f0fe7ff5e8 Document the status slot of jupyter-async-channel 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
ceed853658 Convert jupyter-hb-on-kernel-dead to a method 2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
b6428b441f Fix the heartbeat channel implementation
* Actually set the paused slot to nil when un-pausing the
  heartbeat channel

* Ensure the heartbeat socket is actually a socket when
  receiving. This is to handle edge cases when the
  heartbeat channel is stopped, but there still is a timer
  left in the `timer-list`.
2018-10-25 23:17:25 -05:00
Nathaniel Nicandro
276c02cfce Add more documentation 2018-10-25 23:07:46 -05:00
Nathaniel Nicandro
c070f2d04d Update documentation and comments 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
26b9f90feb Simplify heartbeat channel logic 2018-10-25 22:57:23 -05:00
Nathaniel Nicandro
554e519bf0 Avoid delays during message processing
- Allow specifying a msg-id before a call to `jupyter-send`

  - This avoid sending a message to the browser displaying the widgets on every
    message send to the kernel. The previous implementation generated a new ID
    without allowing the caller to pass one in.

- Simplify message polling by sending received messages from the kernel to the
  parent Emacs process at the moment of arrival.
2018-05-28 01:25:09 -05:00
Nathaniel Nicandro
12c4b61d88 Send the endpoint and identity to the subprocess when starting async channels 2018-05-15 16:45:24 -05:00
Nathaniel Nicandro
fc665655f8 Remove jupyter-connection
To make up for this:
- Move the functions defined in `jupyter-connection.el` to `jupyter-base.el`
- Add a `session` field to the `jupyter-kernel-manager` and `jupyter-channel`
  classes
- Add a `kernel-info` field to the `jupyter-repl-client`
- Add a `conn-info` field to a `jupyter-session`
- Add a `session` field to `jupyter-kernel-client`
2018-05-15 16:45:24 -05:00
Nathaniel Nicandro
bcd45b6db4 Tiny refactors/optimizations 2018-05-13 12:11:08 -05:00
Nathaniel Nicandro
f79c0b68ac Update ZMQ calls for an updated version of ZMQ 2018-05-06 03:15:42 -05:00
Nathaniel Nicandro
98c646bfb5 Block until a channel is stopped in jupyter-stop-channel for async channels 2018-02-12 10:22:13 -06:00
Nathaniel Nicandro
2cb665e744 Check if the ioloop process is live in jupyter-channel-alive-p for async channels 2018-02-04 18:10:32 -06:00
Nathaniel Nicandro
e6d9fcbf5a Add kernel-died-cb for heartbeat channels
This is a callback function which is called when no response has been received
from the kernel after 5 `time-to-dead` periods.
2018-02-04 18:08:05 -06:00
Nathaniel Nicandro
290f3a2d96 Block until channel is alive in jupyter-start-channel for async channels 2018-02-04 17:43:20 -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
5763aa3beb Cleanup/add more documentation for jupyter-channels 2018-01-22 18:48:20 -06:00
Nathaniel Nicandro
1d024d54cc Handle signal interrupts in the heartbeat channel 2018-01-16 11:52:59 -06:00
Nathaniel Nicandro
047968c4e9 Refactor jupyter-start-channel 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
a7539dc37b Fix checkdoc warnings 2018-01-09 00:44:34 -06:00
Nathaniel Nicandro
9ba6ad331e Remove uses of lexical-let 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
f904dc7d2a Rename jupyter-push-message -> jupyter-queue-message 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
cfdf68eb43 Remove channel in some jupyter-channel method names 2018-01-06 19:55:46 -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
Nathaniel Nicandro
2c942fd0b7 Return the message without the identities in jupyter-channel-get-message 2018-01-06 19:55:44 -06:00
Nathaniel Nicandro
9dd45c6f3e Be consistent with how other channels are stopped
Specifically move the `jupyter-channel-alive-p` check into
`jupyter-stop-channel` for the heartbeat channel.
2018-01-06 19:54:40 -06:00
Nathaniel Nicandro
064bf4f031 Add functions to work with a jupyter-channel's recv-queue` 2018-01-02 13:50:13 -06:00
Nathaniel Nicandro
c7c200d571 Heartbeat channels are implemented with timers instead of a subprocess 2017-12-30 23:32:17 -06:00
Nathaniel Nicandro
46a449c496 Raise error when connecting channel with an unknown channel type 2017-12-22 00:54:18 -06:00
Nathaniel Nicandro
c6445530c7 HB channel process ignores signals 2017-12-22 00:53:18 -06:00
Nathaniel Nicandro
e9f04b20f8 Make the hb channel more efficient
Instead of constantly sending the subprocess input on every polling loop, poll
for input on stdin using the poller.
2017-12-19 11:47:45 -06:00
Nathaniel Nicandro
805255e816 New function jupyter-connect-channel
This function returns a socket based on a channel type and endpoint. The
channel type is mapped to the required socket type based on
`jupyter-channel-socket-types`. This is a convenience function to avoid having
to use `jupyter-channel-socket-types` directly.
2017-12-17 02:32:28 -06:00
Nathaniel Nicandro
3a3e742f8a Silence byte compiler 2017-12-14 13:58:46 -06:00
Nathaniel Nicandro
8e7436962b Fix function name 2017-12-14 13:58:18 -06:00
Nathaniel Nicandro
4e8cfb8bf6 Use lexical-let only where its needed 2017-12-14 13:58:18 -06:00
Nathaniel Nicandro
76cf1c5eb7 Semi working prototype 2017-12-13 11:27:13 -06:00