yr.FunctionProxy.options

yr.FunctionProxy.options#

FunctionProxy.options(invoke_options: InvokeOptions) FunctionProxy[source]#

Modify the parameters of the decorated function dynamically.

This method is used to dynamically modify the parameters of a remote function call and return the current function proxy.

Note

This interface does not take effect in local mode.

Parameters:

invoke_options (InvokeOptions) – The invoke options.

Returns:

The FunctionProxy object itself. Data type is FunctionProxy.

Examples

>>> import yr
>>>
>>> yr.init()
>>>
>>> @yr.invoke
... def add(a, b):
...    return a + b
>>>
>>> opt = yr.InvokeOptions(cpu=1000, memory=1024)
>>> ret = add.options(opt).invoke(1, 2)
>>> print(yr.get(ret))
>>>
>>> yr.finalize()