Source code for thread_chunks._remote_actor
1from typing import Tuple, Any, Callable
2from ._actor import LabelledActor
3
[docs]
4class RemoteLabelledActor(LabelledActor):
5 """A remote ray actor that can execute the function `func` along with a
6 label to allow an ordering of calls to be re-established. Additionally, as
7 the actor stores `func` so that copying of `func` only occurs on
8 initialisation opposed to every call of `func`.
9
10 Notes
11 -----
12 All method calls must be proceeded by ``.remote``. For example, to call the
13 ``__init__`` method use:
14
15 .. code-block:: python
16
17 remote_labelled_actor = RemoteLabelledActor.remote(func)
18
19 To call the ``run`` method use:
20
21 .. code-block:: python
22
23 remote_labelled_actor.run.remote(label, *args)
24
25 This is required as the instance is a remote ``ray`` actor.
26 """
[docs]
27 def __init__(self, func: Callable):
28 """Initialises a :class:`RemoteLabelledActor`
29
30 Parameters
31 ----------
32 func : Callable
33 The function saved by the actor.
34 """