example1.rb

Example 1 - Andreas Schröder, 07/11/2007 02:11 am

Download (525 Bytes)

 
1
#!/usr/bin/ruby
2

    
3

    
4
require 'libdrqueue'
5

    
6

    
7
puts "Master: #{ENV["DRQUEUE_MASTER"]}\n"
8

    
9
computer_list = Libdrqueue::request_computer_list(Libdrqueue::CLIENT)
10
puts "Computers connected to the master:"
11
computer_list.each do |c|
12
        print "ID: #{c.hwinfo.id} Name: #{c.hwinfo.name} | Enabled: "
13
        if "#{c.limits.enabled}" == "1"
14
                print "Yes\n"
15
        else
16
                print "No\n"
17
        end
18
end
19

    
20
puts "\nJobs registered in the master:"
21
job_list = Libdrqueue::request_job_list(Libdrqueue::CLIENT)
22
job_list.each do |j|
23
        puts "ID: #{j.id} Name: #{j.name}"
24
end