thread_chunks.LabelledActor

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

Bases: object

A 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.

Methods

__init__

Initialises a LabelledActor

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 LabelledActor

Parameters:

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

get_func() Callable[source]

Gets the function func stored by the actor.

Returns:

The stored function.

Return type:

Callable

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

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)[source]

Updates the function func stored by the actor.

Parameters:

func (Callable) – The new function.