PySeqBackend

The class is specific implementation of Backend interface using native Python Sequential functionality. The Python Sequential backend provides sequential execution in main process, that can be used for debug purposes.

API

class unidist.core.backends.pyseq.backend.PySeqBackend

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

static cluster_resources()

Get resources of the cluster.

Returns:

Dictionary with node info in the form {“node_ip”: {“CPU”: x}}.

Return type:

dict

static get(data_ids)

Get an object or a list of objects from object store.

Parameters:

data_ids (unidist.core.backends.common.data_id.DataID or list) – DataID or a list of DataID objects to get data from.

Returns:

A Python object or a list of Python objects.

Return type:

object

static get_ip()

Get node IP address.

Returns:

Node IP address.

Return type:

str

static is_initialized()

Check if Python Sequential backend has already been initialized.

Returns:

True or False.

Return type:

bool

static make_actor(cls, num_cpus, resources)

Define an actor class.

clsobject

Class to be an actor class.

num_cpusint

The number of CPUs to reserve for the lifetime of the actor.

resourcesdict

Custom resources to reserve for the lifetime of the actor.

Returns:

  • PySeqActor – The actor class type to create.

  • list – The list of arguments for PySeqActor constructor.

static make_remote_function(function, num_cpus, num_returns, resources)

Define PySeqRemoteFunction.

functioncallable

Function to be PySeqRemoteFunction.

num_cpusint

The number of CPUs to reserve for PySeqRemoteFunction.

num_returnsint

The number of ObjectRef-s returned by the function invocation.

resourcesdict

Custom resources to reserve for the function.

Return type:

PySeqRemoteFunction

static num_cpus()

Get the number of CPUs used by the execution backend.

Return type:

int

static put(data)

Put data into object store.

Parameters:

data (object) – Data to be put.

Returns:

DataID matching to data.

Return type:

unidist.core.backends.common.data_id.DataID

static wait(data_ids, num_returns=1)

Wait until data_ids are finished.

This method returns two lists. The first list consists of data IDs that correspond to objects that completed computations. The second list corresponds to the rest of the data IDs.

Parameters:
Returns:

List of data IDs that are ready and list of the remaining data IDs.

Return type:

tuple

Notes

Method serves to maintain behavior compatibility between backends. All objects completed computation before putting into an object storage for Python Sequential backend.