Source code for sesf.msgtransfer.service_node

Module **sesf.msgtransfer.service_node** has class ``Node`` that
has the signature of a msgtransfer implementation node
and redirects incoming calls to RPC calls to a running service
with pyrodaemon `sesf.msgtransfer.service`.

import Pyro4, argparse

[docs]class Node(): def __init__(self, argv): # argv == 'model_node num_nodes myid' p = argparse.ArgumentParser() p.add_argument("num_nodes", type=int) p.add_argument("myid", type=int) args = p.parse_args(argv[1:]) self.num_nodes = args.num_nodes self.myid = args.myid print("getting proxies for msgtransfer service", flush=True) self.sendproxy = Pyro4.Proxy("PYRONAME:sesf.msgtransfer.service") self.recvproxy = Pyro4.Proxy("PYRONAME:sesf.msgtransfer.service") self.endproxy = Pyro4.Proxy("PYRONAME:sesf.msgtransfer.service") def send(self, k, msg): # print("msgpasser send", k, msg, "calling cproxy", flush=True) return self.sendproxy.send(self.myid, k, msg) # print("msgpasser send", k, msg, "returning from cproxy", flush=True) def recv(self): return self.recvproxy.recv(self.myid) def end(self): return self.endproxy.end(self.myid)
# end class Node