Class: Zhong::Web

Inherits:
Sinatra::Base
  • Object
show all
Defined in:
lib/zhong/web.rb

Instance Method Summary collapse

Instance Method Details

#indexObject



55
56
57
58
59
60
# File 'lib/zhong/web.rb', line 55

def index
  @jobs = Zhong.jobs.values
  @last_runs = zhong_mget(@jobs, "last_ran")
  @disabled = zhong_mget(@jobs, "disabled")
  @hosts = Zhong.all_heartbeats
end

#zhong_mget(jobs, key) ⇒ Object



62
63
64
65
66
# File 'lib/zhong/web.rb', line 62

def zhong_mget(jobs, key)
  keys = jobs.map(&:to_s)
  ret = Zhong::Util.safe_mget(keys.map { |j| "zhong:#{key}:#{j}" })
  Hash[keys.map { |j| [j, ret["zhong:#{key}:#{j}"]] }]
end