Commit graph

211 commits

Author SHA1 Message Date
Nathaniel Nicandro
de9f85cc2e Update documentation, cleanup comments
* Remove implementation details in documentation strings

* Canonicalize documentation of functions which perform similar operations.
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
c3681bdb8c Add methods to hook into request creation/deletion
- Add the method `jupyter-generate-request` to allow subclasses to initialize
  their own request objects with extra fields in addition to those of
  `jupyter-request`.

- Add the method `jupyter-drop-request` to allow subclasses to do any cleanup
  once a request is complete.
2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
aab35e6eed Include missing status field in execute-reply handler 2018-10-16 13:55:30 -05:00
Nathaniel Nicandro
22b1e809a0 Update documentation, cleanup comments 2018-08-30 18:02:13 -05:00
Nathaniel Nicandro
3c34c1f7ed Do not handle reply messages with an error status specially 2018-05-30 12:49:28 -05:00
Nathaniel Nicandro
ff54004129 Do not rely on message time when dropping requests 2018-05-30 12:49:28 -05:00
Nathaniel Nicandro
e654487b2a Allow the possibility of preempting the handler methods using message hooks 2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
436089d08b Prefer defun over defsubst and other miscellaneous changes
- Add missing namespace to sha256 function

  - Any function defined should have a `jupyter-` prefix

- Remove `cl-lib` dependency in `jupyter-messages.el`

- Include `subr-x` in `jupyter-base.el`

- Use `tramp-file-name-user` instead of `tramp-file-name-real-user` since the
  latter is missing in Emacs 26
2018-05-28 01:25:33 -05:00
Nathaniel Nicandro
f315a4bab0 Store open comm state in a jupyter-kernel-client 2018-05-28 01:25:33 -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
50088df2e0 Add widget support 2018-05-28 01:25:09 -05:00
Nathaniel Nicandro
704e6d53ce Update documentation 2018-05-20 10:58:13 -05:00
Nathaniel Nicandro
39c985d65d Validate jupyter-inhibit-handlers before sending a message 2018-05-16 21:54:30 -05:00
Nathaniel Nicandro
94171eba4a Update documentation 2018-05-16 21:54:29 -05:00
Nathaniel Nicandro
1841e49b5d Be consistent with message types
Only use the message symbol's as defined in `jupyter-message-types` and switch
to the string representation only when sending a message.
2018-05-16 20:46:10 -05:00
Nathaniel Nicandro
3b3fe9c43f jupyter-<type> -> jupyter-send-<type> where appropriate 2018-05-16 12:25:57 -05:00
Nathaniel Nicandro
07ee759f90 Introduce jupyter-tunnel-connection 2018-05-15 23:43:33 -05:00
Nathaniel Nicandro
d93b7d7099 Add jupyter-read-plist 2018-05-15 23:43:32 -05:00
Nathaniel Nicandro
62e63412de Tiny changes 2018-05-15 16:45:26 -05:00
Nathaniel Nicandro
c0e4383c49 Add more debug statements 2018-05-15 16:45:25 -05:00
Nathaniel Nicandro
b49d138fdb Check that the process is live in jupyter-stop-channels 2018-05-15 16:45:25 -05:00
Nathaniel Nicandro
29ccac12d0 Add hearbeat channel convenience methods 2018-05-15 16:45:25 -05:00
Nathaniel Nicandro
7d7b7650b9 Mainly code style changes 2018-05-15 16:45:24 -05:00
Nathaniel Nicandro
670611ded1 Update code comments and documentation 2018-05-15 16:45:24 -05:00
Nathaniel Nicandro
6a68cb6180 Introduce jupyter-dispatch-message-cases 2018-05-15 16:45:24 -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
cf963afa45 Set the last message time on the request after handling the message 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
ef69521202 Update documentation and comments 2018-02-12 11:06:09 -06:00
Nathaniel Nicandro
56a36b8fa0 Remove the need to queue messages in a complicated way
Messages were queued by the messages sent timestamp in the message header as
well as based on the channel the message was received on because there is no
guarantee on the order of the received messages. This matters because a request
is dropped from a client's request table when an idle message is received, but
this idle message is not guaranteed to be the last message received for a
request, for example a reply message may come after the idle message has been
received.

Now if a request has received an idle message already, instead of
dropping it immediately, drop it only when the last received message time for
the request is longer than a few seconds.
2018-02-12 10:47:26 -06:00
Nathaniel Nicandro
ad0aefe307 Handle error messages through the IOPub error handler or callbacks
Handler methods are only run on a successful request. If an error occurs during
execution an error message is emitted on the IOPub channel, this is where
errors are handled. Or they can be captured in the reply messages through
callbacks.
2018-02-12 10:25:36 -06:00
Nathaniel Nicandro
24eb475443 Cleanup comments 2018-02-12 10:25:13 -06:00
Nathaniel Nicandro
86be51eb72 Don't rely on the event string in a process sentinel 2018-02-09 17:23:46 -06:00
Nathaniel Nicandro
b0186f3201 Take into account messages with no associated requests
For example, IOPub messages from other clients
2018-02-09 17:22:45 -06:00
Nathaniel Nicandro
b5f958ac99 More granular way of inhibiting handlers
`jupyter-inhibit-handlers` can now be a list of message types. If a message is
received and has one of these message types, then the client handler
corresponding to that message type is prevented from running.
2018-02-08 13:39:55 -06:00
Nathaniel Nicandro
83881bf4e0 Ensure the startup message is caught
Setup the necessary hooks before starting the kernel so that we can ensure that
the startup message is caught.

A short delay is also added whenever we start a channel. This was necessary for
the client to catch the startup message of a python kernel.
2018-02-07 12:08:07 -06:00
Nathaniel Nicandro
072dce7c00 Negligible changes 2018-02-04 18:22:56 -06:00
Nathaniel Nicandro
90dd699a7a Update comments 2018-02-04 18:15:32 -06:00
Nathaniel Nicandro
ca6c2ae37a Simplify wording of jupyter-add-callback documentation 2018-02-04 18:06:11 -06:00
Nathaniel Nicandro
4a0cff991d Add jupyter-ioloop-wait-until to wait for events from ioloop subprocess 2018-02-04 17:55:47 -06:00
Nathaniel Nicandro
2ffbf74149 Flush stdout after sending all messages in ioloop subprocess 2018-02-04 17:44:27 -06:00
Nathaniel Nicandro
fe323cf623 Properly stop channels in ioloop subprocess 2018-02-04 17:43:59 -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
b72713b00c Remove the special behavior when dropping requests 2018-02-04 17:41:48 -06:00
Nathaniel Nicandro
91da143fb1 Simplify making jupyter-request objects when sending a message 2018-02-03 19:16:16 -06:00
Nathaniel Nicandro
80509f275c Only allow stdin messages when the stdin channel is alive 2018-02-03 19:15:28 -06:00
Nathaniel Nicandro
019309efcd Cleanup indentation 2018-02-03 19:14:24 -06:00
Nathaniel Nicandro
95a5cfbd74 Add jupyter--get-channel 2018-02-03 19:10:30 -06:00