Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
various small cleanups. Not quite there yet
[simgrid.git] / src / bindings / ruby / Slave.rb
1 require 'msg'
2 require 'RubyProcess'
3 require 'RubyTask'
4 include MSG
5
6 class Slave < RbProcess
7   
8   def initialize(*args)
9     
10     
11     puts "Hello From Slave"
12     s_mailbox = "slave" + args[0]
13     
14     
15     while true
16       
17       task = RbTask.recieve(s_mailbox)
18       
19       task_name = RbTask.name(task)
20       
21       if ( task_name == "finalize" )
22         puts "Slave" + s_mailbox + "got finalize msg"
23         break
24       end
25       
26       puts "Slave " + s_mailbox + "Processing" + RbTask.name(task)
27       RbTask.execute(task)
28       
29     end
30         
31     puts "Slave " + s_mailbox + "I'm Done , See You !!"
32       
33       
34     end
35     
36     
37   end
38   
39   
40
41 # slave = Slave.new