PySeqRemoteFunction

The class is specific implementation of RemoteFunction class using native Python Sequential functionality.

The PySeqRemoteFunction implements internal method _remote() that transmites execution of operations to core part of Python Sequential backend.

API

class unidist.core.backends.pyseq.remote_function.PySeqRemoteFunction(function, num_cpus, num_returns, resources)

The class that implements the interface in RemoteFunction using Python Sequential backend.

Parameters:
  • function (callable) – A function to be called.

  • num_cpus (int) – The number of CPUs to reserve for the function.

  • num_returns (int) – The number of ObjectRef-s returned by the function invocation.

  • resources (dict) – Custom resources to reserve for the function.

_remote(*args, num_cpus=None, num_returns=None, resources=None, **kwargs)

Execute self._remote_function.

Parameters:
  • *args (iterable) – Positional arguments to be passed in the self._remote_function.

  • num_cpus (int, optional) – The number of CPUs to reserve for the function.

  • num_returns (int, optional) – The number of ObjectRef-s returned by the function invocation.

  • resources (dict, optional) – Custom resources to reserve for the function.

  • **kwargs (dict) – Keyword arguments to be passed in the self._remote_function.

Returns:

Type of returns depends on num_returns value:

  • if num_returns == 1, ObjectRef will be returned.

  • if num_returns > 1, list of ObjectRef will be returned.

  • if num_returns == 0, None will be returned.

Return type:

ObjectRef, list or None