forked from goodboy/tractor
1
0
Fork 0

Tweak doc string

ctx_cancel_semantics_and_overruns
Tyler Goodlet 2023-04-14 18:08:08 -04:00
parent 20d75ff934
commit 7293b82bcc
1 changed files with 11 additions and 7 deletions

View File

@ -64,21 +64,25 @@ log = get_logger(__name__)
@dataclass @dataclass
class Context: class Context:
''' '''
An inter-actor, ``trio`` task communication context. An inter-actor, ``trio``-task communication context.
NB: This class should never be instatiated directly, it is delivered NB: This class should never be instatiated directly, it is delivered
by either, by either,
- runtime machinery to a remotely started task or, - runtime machinery to a remotely started task or,
- by entering ``Portal.open_context()``. - by entering ``Portal.open_context()``.
and is always constructed using ``mkt_context()``.
Allows maintaining task or protocol specific state between Allows maintaining task or protocol specific state between
2 communicating actor tasks. A unique context is created on the 2 communicating, parallel executing actor tasks. A unique context is
callee side/end for every request to a remote actor from a portal. allocated on each side of any task RPC-linked msg dialog, for
every request to a remote actor from a portal. On the "callee"
side a context is always allocated inside ``._runtime._invoke()``.
A context can be cancelled and (possibly eventually restarted) from A context can be cancelled and (possibly eventually restarted) from
either side of the underlying IPC channel, open task oriented either side of the underlying IPC channel, it can also open task
message streams and acts as an IPC aware inter-actor-task cancel oriented message streams, and acts more or less as an IPC aware
scope. inter-actor-task ``trio.CancelScope``.
''' '''
chan: Channel chan: Channel
@ -744,7 +748,7 @@ def mk_context(
_recv_chan=recv_chan, _recv_chan=recv_chan,
**kwargs, **kwargs,
) )
ctx._result = id(ctx) ctx._result: int | Any = id(ctx)
return ctx return ctx