3 -- Splay global modules
12 -- Splay global variables
15 job.list_type = "random"
19 for i = 1, simgrid.host.number() do
20 job.nodes[i] = { ip = simgrid.host.get_prop_value(simgrid.host.at(i), "ip"),
21 port = simgrid.host.get_prop_value(simgrid.host.at(i), "port") }
31 return simgrid.host.get_prop_value(simgrid.host.self(), "ip")
34 function job.me.port()
35 return simgrid.host.get_prop_value(simgrid.host.self(), "port")
39 function job.position()
40 return simgrid.host.get_prop_value(simgrid.host.self(), "position")
44 function log:print(msg)
49 function rpc.call(node, call)
55 if type(node) == "table" then
56 mailbox = node.ip..":"..node.port
59 if type(call) == "table" then
63 task_call = simgrid.task.new("splay_task", 10000, 10000)
64 task_call['func_call_name'] = func
65 task_call['func_call_arg'] = arg
66 log:print("Sending Task to mailbox "..mailbox.." to call '"..func.."' with arg '"..arg.."'")
67 simgrid.task.send(task_call, mailbox)
71 function rpc.server(port)
72 -- nothing really to do : no need to open Socket since it's a Simulation
76 function events.sleep(time)
77 my_mailbox = job.me.ip()..":"..job.me.port()
78 task = simgrid.task.recv(my_mailbox, time)
81 -- an RPC call just woke me up
82 call_function(task['func_call_name'], task['func_call_arg'])
86 -- main function for each process, this is equivalent to the deployment file
87 function events.thread(main_func)
88 dofile("platform_script.lua")
94 simgrid.host.destroy(simgrid.host.self())
104 function misc.between(a, b)
109 function call_function(fct, arg)
113 function SPLAYschool(arg)
114 simgrid.info("Calling me..."..arg)