Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Kill the MSG_paje_output() function. It's a noop since 2 years
[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()
9     super()
10   end
11   
12   #for Testing
13   def msg_main2(args)
14     info("Hello From Slave")
15   end
16   
17   
18   
19   
20   
21  # msg_main : that function that will be executed when Running Simulation
22   def msg_main(args)
23     info("Hello From Slave")
24     s_mailbox = "slave>>" + args[0]
25
26     while true
27         
28        info("Ready to Receive Task")
29        task = RbTask.receive(s_mailbox)
30        task_name = RbTask.name(task)
31        info ("Task Received : " + task_name)
32       if (task_name == "finalize")
33         info("Slave" + s_mailbox + "got finalize msg")
34         break
35       end
36       info("Slave " + s_mailbox + " ...Processing" + RbTask.name(task))
37        RbTask.execute(task)
38     end
39     info("Slave " + s_mailbox +  "I'm Done , See You !!")
40     end
41     
42   end