daily pastebin goal
58%
SHARE
TWEET

Untitled

a guest Jan 14th, 2018 38 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #!/usr/bin/env ruby
  2. # growl notify on cluster WAITING
  3. require 'rubygems'
  4. require 'ruby-growl'
  5. require 'json'
  6.  
  7. def g(msg)
  8. puts "growl -> #{msg}"
  9. Growl.run ['-H', "127.0.0.1",
  10. '-m', msg,
  11. '-t', 'Elastic Map Reduce']
  12. end
  13.  
  14. count = ARGV.first.to_i
  15.  
  16. loop do
  17. desc = JSON.parse `elastic-mapreduce --describe`
  18. desc['JobFlows'].each do |jf|
  19. if jf['ExecutionStatusDetail']['State'] =~ /WAIT/
  20. g "#{jf['JobFlowId']} is WAITING"
  21. end
  22. end
  23. break if count == 1
  24. count -= 1
  25. sleep 60
  26. end
RAW Paste Data
Top