【发布时间】:2015-02-17 02:09:45
【问题描述】:
我见过使用teleport_function 传递函数,有什么方法可以传递类方法吗??或者我可以以任何其他方式远程执行我的类对象
我可以通过将类作为服务来替代工作。但这并不能完全满足我在项目中的要求。
【问题讨论】:
-
向我们展示您的代码。尝试“传送”类方法时遇到什么错误?
我见过使用teleport_function 传递函数,有什么方法可以传递类方法吗??或者我可以以任何其他方式远程执行我的类对象
我可以通过将类作为服务来替代工作。但这并不能完全满足我在项目中的要求。
【问题讨论】:
import rpyc
from rpyc.utils.classic import teleport_function
def a(test):
print test
if __name__ = '__main__':
proxy = rpyc.classic.connect('remte.com')
launch_command_remote = teleport_function(proxy, a)
launch_command_remote("Voila") # Executed remotly
【讨论】: