yr.MethodProxy.invoke

yr.MethodProxy.invoke#

MethodProxy.invoke(*args, **kwargs) yr.ObjectRef[source]#

Execute remote invoke to user functions.

Parameters:
  • *args – Variable arguments, used to pass non-keyword arguments.

  • **kwargs – Variable arguments, used to pass keyword arguments.

Returns:

Reference to a data object. Data type is ObjectRef.

Raises:

TypeError – If the parameter type is incorrect.

Example

>>> import yr
>>> yr.init()
>>>
>>> @yr.instance
... class Instance:
...     sum = 0
...
...     def add(self, a):
...         self.sum += a
...
...     def get(self):
...         return self.sum
...
>>> ins = Instance.invoke()
>>> yr.get(ins.add.invoke(1))
>>>
>>> print(yr.get(ins.get.invoke()))
>>>
>>> ins.terminate()
>>>
>>> yr.finalize()