python - rpyc: difference between root.getmodule("module_name") and manually returning a module reference? -
i want use python module accessible on remote rpyc server only. there difference between following 2 ways of accessing modules on remote machine:
""" on client side: """
my_local_mod_ref = my_rpyc_connection.root.getmodule("remote_module_name")my_local_mod_ref = my_rpyc_connection.root.a_func_returning_the_module_ref()
""" on server side: """
def exposed_a_func_returning_the_module_ref() import my_remote_module_name return my_remote_module_name if there difference, of 2 alternatives cleaner or preferable?
here implementation of getmodule:
def exposed_getmodule(self, name): """imports arbitrary module""" return __import__(name, none, none, "*") as can see, if module not loaded in server, calling getmodule imports it, , (either way) netref object module returned.
if matches behavior of a_func_returning_the_module_ref(), there's no difference.
i'd guess getmodule provided out-of-the-box, being useful, don't have define (or similar) explicitly in order achieve goal.
Comments
Post a Comment