Skip to content

Instantly share code, notes, and snippets.

@MMesch
Created May 26, 2018 09:02
Show Gist options
  • Save MMesch/24bb44132957f78001d25287255c9648 to your computer and use it in GitHub Desktop.
Save MMesch/24bb44132957f78001d25287255c9648 to your computer and use it in GitHub Desktop.
jupyter kernel gateway communication from bash
#!/usr/bin/env bash
trap "trap - SIGTERM && kill -- -$$" SIGINT SIGTERM EXIT
echo -e "\n==== START GATEWAY ===="
jupyter kernelgateway --JupyterWebsocketPersonality.list_kernels=True &
sleep 3
echo -e "\n==== PING GATEWAY API ===="
curl localhost:8888/api
echo -e "\n==== START KERNEL ===="
curl -X POST -d '{"name": "python3"}' localhost:8888/api/kernels
echo -e "\n==== GET LIST OF RUNNING KERNELS ===="
curl -X GET localhost:8888/api/kernels
echo -e "\n\e[32m==== ALL DONE ====\e[39m"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment