def __call__(self, *args, **kwargs):
"""Must be used with 'yeild' as 'rtask = yield rti(*args, **kwargs)'.
Run RTI (method at remote location) with args and kwargs. Both args and
kwargs must be serializable. Result is (remote) Task instance if call
succeeds, otherwise it is None.
"""
req = _NetRequest('run_rti', kwargs={'name': self._name, 'args': args, 'kwargs': kwargs,
'mid': self._mid},
dst=self._location, timeout=MsgTimeout)
reply = yield _Peer._sync_reply(req)
if isinstance(reply, Task):
raise StopIteration(reply)
elif reply is None:
raise StopIteration(None)
else:
raise Exception(reply)
评论列表
文章目录