3618: now can use a list of sort columns if there are multiple models involved
[arvados.git] / doc / examples / ruby / list-active-nodes.rb
1 #!/usr/bin/env ruby
2
3 abort 'Error: Ruby >= 1.9.3 required.' if RUBY_VERSION < '1.9.3'
4
5 require 'arvados'
6
7 arv = Arvados.new(api_version: 'v1')
8 arv.node.list[:items].each do |node|
9   if node[:crunch_worker_state] != 'down'
10     ping_age = (Time.now - Time.parse(node[:last_ping_at])).to_i rescue -1
11     puts "#{node[:uuid]} #{node[:crunch_worker_state]} #{ping_age}"
12   end
13 end