example2.rb

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

Download (853 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
        print "Frames: "
25
        frame_list = j.request_frame_list(Libdrqueue::CLIENT)
26
        index = 0
27
        frame_list.each do |f|
28
                begin
29
                        computer_name = computer_list[f.icomp].hwinfo.name
30
                rescue
31
                        computer_name = "None"
32
                end
33
                puts "\tFrame: #{j.frame_index_to_number(index)} Status: #{f.status} Computer: #{computer_name}"
34
                index += 1
35
        end
36
end