How to distribute code using code server to slave nodes
Angel Alvarez
clist@REDACTED
Wed Jul 22 00:06:06 CEST 2009
Hi
Im learning erlang so i use to write toy programs just for fun
now Im learning to use the pool module, so i cant spread workers over some computers.
The problem is that prior to pspawn processes i have to manually distribute code among all members of the pool.
I use to write something like this (i saw this somewhere on the net...)
pool:start(pooltest, lists:concat(["-setcookie ", erlang:get_cookie()])),
distribute_app([mymodule1,mymodule2, ... , mymodulen]),
with distribute_app as:
distribute_app(Modules) ->
%% extraer todos los nodos excepto el Master
RemoteNodes = [X || X <- pool:get_nodes(), X =/= node()],
%% Transferir el código
lists:foreach(fun(Node) -> transfer_code(Node, Modules) end, RemoteNodes).
transfer_code(Node, Modules) ->
[transfer_module(Node, Module) || Module <- Modules].
transfer_module(Node, Module) ->
{_Module, Binary, FileName} = code:get_object_code(Module),
rpc:call(Node, code, load_binary, [Module, FileName, Binary]).
Instead of doing this, can i instruct remote code servers to ask master code server for code when
it need to locate new refences?
Is seems to be related to starting erl with "--loader inet" ¿Can anyone prove me with some pointers about this?
Thanks
--
Agua para todo? No, Agua para Todos.
->>-----------------------------------------------
Clist UAH a.k.a Angel
---------------------------------[www.uah.es]-<<--
Vivimos en un sociedad exquisitamente dependiente de la ciencia y la tecnología, cuando muy poco gente conoce algo de la ciencia ó de la tecnología.
More information about the erlang-questions
mailing list