thread_chunks.RemoteLabelledActor

class thread_chunks.RemoteLabelledActor(func: Callable)[source]

Bases: LabelledActor

A remote ray actor that can execute the function func along with a label to allow an ordering of calls to be re-established. Additionally, as the actor stores func so that copying of func only occurs on initialisation opposed to every call of func.

Notes

All method calls must be proceeded by .remote. For example, to call the __init__ method use:

remote_labelled_actor = RemoteLabelledActor.remote(func)

To call the run method use:

remote_labelled_actor.run.remote(label, *args)

This is required as the instance is a remote ray actor.

Methods

__init__

Initialises a RemoteLabelledActor

get_func

Gets the function func stored by the actor.

run

A wrapping that allows labelled execution of the function.

set_func

Updates the function func stored by the actor.

__init__(func: Callable)[source]

Initialises a RemoteLabelledActor

Parameters:

func (Callable) – The function saved by the actor.

get_func() Callable

Gets the function func stored by the actor.

Returns:

The stored function.

Return type:

Callable

run(label: Any, *args: Any) Tuple[Any, Any]

A wrapping that allows labelled execution of the function.

Parameters:
  • label (Any) – The label assigned to the execution.

  • *args (Any) – The arguments to pass to the stored function func.

Returns:

The label followed by the return of func.

Return type:

Tuple[Any, Any]

set_func(func: Callable)

Updates the function func stored by the actor.

Parameters:

func (Callable) – The new function.