2 -- Splay global modules
10 -- Splay global variables
13 job.list_type = "random"
16 for i= 1,simgrid.Host.number() do
17 job.nodes[i] = simgrid.Host.getPropValue(simgrid.Host.at(i),"ip")..":"..simgrid.Host.getPropValue(simgrid.Host.at(i),"port");
28 return simgrid.Host.getPropValue(simgrid.Host.self(),"ip");
32 function job.me.port()
33 return simgrid.Host.getPropValue(simgrid.Host.self(),"port");
37 function job.position()
38 return simgrid.Host.getPropValue(simgrid.Host.self(),"position");
42 function log:print(msg)
47 function rpc.call(node,call)
53 if type(node) == "table" then
54 mailbox = node.ip..":"..node.port
57 if type(call) == "table" then
61 task_call = simgrid.Task.new("splay_task",10000,10000);
62 task_call['func_call_name'] = func;
63 task_call['func_call_arg'] = arg;
64 log:print("Sending Task to mailbox "..mailbox.." to call '"..func.."' with arg '"..arg.."'");
65 simgrid.Task.iSend(task_call,mailbox);
69 function rpc.server(port)
70 -- nothing really to do : no need to open Socket since it's a Simulation
75 function events.sleep(time)
76 my_mailbox = job.me.ip()..":"..job.me.port()
77 tk = simgrid.Task.splay_recv(my_mailbox, time)
79 if type(tk) == "table" then
80 call_function(task['func_call_name'],task['func_call_arg'])
81 else log:print("task type is :"..type(tk).." it must be table?!");
86 -- main func for each process, this is equivalent to the Deploiment 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)