Skip to content

Instantly share code, notes, and snippets.

@EricLondon
Last active October 5, 2017 14:14
Show Gist options
  • Save EricLondon/a4ba93775a682cb2fa6b9a341a76e7a1 to your computer and use it in GitHub Desktop.
Save EricLondon/a4ba93775a682cb2fa6b9a341a76e7a1 to your computer and use it in GitHub Desktop.
EMR/Zeppelin API notebook status check
#!/usr/bin/env ruby
require 'open-uri'
require 'json'
require 'pp'
ZEP_HOST = 'localhost'
ZEP_PORT = 8890
ZEP_ADDR = "http://#{ZEP_HOST}:#{ZEP_PORT}"
# list notebooks
notebooks = JSON.parse(open("#{ZEP_ADDR}/api/notebook").read)['body']
notebooks.each do |notebook|
puts "--------------------------------------------------"
pp notebook
status = JSON.parse(open("#{ZEP_ADDR}/api/notebook/job/#{notebook['id']}").read)['body']
pp status
end
__END__
# Usage:
curl https://gist.githubusercontent.com/EricLondon/a4ba93775a682cb2fa6b9a341a76e7a1/raw/934c89917fcb021af74be5f81edd07ce8a9c1a86 > emr-zeppelin-status.rb
chmod +x emr-zeppelin-status.rb
./emr-zeppelin-status.rb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment