Skip to content

Instantly share code, notes, and snippets.

@tonyfraser
Last active September 25, 2019 21:18
Show Gist options
  • Save tonyfraser/5c69c2df3aa688f167ca081301e5217c to your computer and use it in GitHub Desktop.
Save tonyfraser/5c69c2df3aa688f167ca081301e5217c to your computer and use it in GitHub Desktop.
use curl to trigger the zeppelin api within a mesos cluster
#!/bin/bash
# -> remember to run: dcos auth login first !!
DCOS_API_TOKEN=$(dcos config show core.dcos_acs_token)
url="http://{marathon-domain}/service/{marathon zeppelin name}"
notebook="2E617JZX1" # $url/#/notebook/2E617JZX1
paragraph="20190916-164803_817623738"
#Note: to get paragraph ID, download notebook, open json and look for -> paragraphs -> Item [N] -> id.
curl --request GET -s -H "Content-Type: application/json" -H "Authorization: token=$DCOS_API_TOKEN" $url/api/notebook
echo
echo "run a full notebook"
curl --request POST -H "Content-Type: application/json" -H "Authorization: token=$DCOS_API_TOKEN" $url/api/notebook/job/$notebook
echo
echo "clear all results from a a notebook"
curl --request PUT -H "Content-Type: application/json" -H "Authorization: token=$DCOS_API_TOKEN" $url/api/notebook/$notebook/clear
echo
echo "run just one paragraph from a notebook"
curl --request POST -H "Content-Type: application/json" -H "Authorization: token=$DCOS_API_TOKEN" $url/api/notebook/run/$notebook/$paragraph
echo
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment