Switch branches/tags
Nothing to show
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
48 lines (32 sloc) 2.38 KB

Kernel Gateway Language Support Demonstration

The Kernel Gateway is a JupyterApp that implements different APIs and protocols for accessing Jupyter kernels. We can use the Jupyter kernel gateway to process requests and transform an annotated notebook into a HTTP API using the Jupyter kernel gateway.

The example notebooks here show how one can use the Jupyter kernel gateway in a language agnostic manner by implementing a simple scotch recommendation API in R, Julia, and Python:

Run the Examples

To run all three APIs, get docker and docker-compose. Then execute the following commands:

docker-compose build
docker-compose up

At this point, you'll have:

  • The R API running on port 9000
  • The Python API running on port 9001
  • The Julia API running on port 9002
  • A Jupyter Notebook server on port 8888 (so you can poke at the underlying notebooks)

The purpose of these notebooks is to demonstrate the multilanguage support of the kernel gateway. The API output may be slightly different between the various languages.

Query the API

To test the services, point your web browser (or favorite web client) to one of the API ports above:

Updating the Notebooks

The docker-compose recipe here volume mounts the source notebooks into every container. If you make changes to one of the notebooks using the Jupyter Notebook server running on port 8888, the changes are not immediately reflected in the corresponding kernel gateway container until you restart it. For example, if you change the API defined in scotch_api_python.ipynb, you must run the following command to start using the new code in the Python API on port 9001:

docker-compose restart python_api