horus icon indicating copy to clipboard operation
horus copied to clipboard

Add a helper to execute an anonymous function remotely

Open dumbbell opened this issue 2 years ago • 0 comments

It's possible to use erpc:call/2 or erpc:multicall/2 to execute an anonymous function remotely. However, it relies on the fact that the module is available on the remote node.

It would be nice to cover the use case where the remote node does not have the module where the anonymous function is defined. Horus could extract the function and load it on the remote node.

The API could look like:

-spec exec(Node | Nodes, StandaloneFun, Args) -> Ret when
      Node :: node(),
      Nodes :: [node()],
      StandaloneFun :: horus_fun(),
      Args :: [any()]).

Or remote_exec/3 or rpc/3 if exec/3 is too confusing vs. exec/2.

dumbbell avatar Nov 08 '23 22:11 dumbbell