forked from goodboy/tractor
1
0
Fork 0
tractor/tractor
Tyler Goodlet 9cd5d2d7b9 Explicitly formalize context/streaming teardown
Add clear teardown semantics for `Context` such that the remote side
cancellation propagation happens only on error or if client code
explicitly requests it (either by exit flag to `Portal.open_context()`
or by manually calling `Context.cancel()`).  Add `Context.result()`
to wait on and capture the final result from a remote context function;
any lingering msg sequence will be consumed/discarded.

Changes in order to make this possible:
- pass the runtime msg loop's feeder receive channel in to the context
  on the calling (portal opening) side such that a final 'return' msg
  can be waited upon using `Context.result()` which delivers the final
  return value from the callee side `@tractor.context` async function.
- always await a final result from the target context function in
  `Portal.open_context()`'s `__aexit__()` if the context has not
  been (requested to be) cancelled by client code on block exit.
- add an internal `Context._cancel_called` for context "cancel
  requested" tracking (much like `trio`'s cancel scope).
- allow flagging a stream as terminated using an internal
  `._eoc` flag which will mark the stream as stopped for iteration.
- drop `StopAsyncIteration` catching in `.receive()`; it does
  nothing.
2021-07-02 11:59:12 -04:00
..
testing Drop tractor.run() from @tractor_test 2021-01-08 20:56:03 -05:00
__init__.py Expose streaming components at top level 2021-07-02 11:58:45 -04:00
_actor.py Specially raise a `ContextCancelled` for a task-context rpc 2021-07-02 11:59:07 -04:00
_child.py Docstring to the top\!, and redundant spaces goodbye\! 2020-07-29 15:39:38 -03:00
_debug.py Fix up var naming and typing 2021-07-02 11:58:01 -04:00
_discovery.py Port inter-process method calls to `Portal.run_from_ns()` 2020-12-22 10:39:47 -05:00
_entry.py Support sync code breakpointing via built-in 2021-02-21 12:36:00 -05:00
_exceptions.py Add a specially handled `ContextCancelled` error 2021-07-02 11:58:44 -04:00
_forkserver_override.py Ignore type checks on stdlib overrides 2021-02-21 14:08:23 -05:00
_ipc.py Add our own "transport closed" signal 2021-07-02 11:36:22 -04:00
_mp_fixup_main.py Fix more stdlib typing issues with latest mypy 2021-02-21 12:48:03 -05:00
_portal.py Explicitly formalize context/streaming teardown 2021-07-02 11:59:12 -04:00
_root.py Shield around root actor cancel 2021-05-06 12:05:17 -04:00
_spawn.py Re-raise any sidestepped `trio.Cancelled` 2021-05-06 12:05:17 -04:00
_state.py Add a no runtime error 2021-04-28 12:23:08 -04:00
_streaming.py Explicitly formalize context/streaming teardown 2021-07-02 11:59:12 -04:00
_trionics.py Be more pedantic with error handling 2021-07-02 11:58:01 -04:00
log.py Add a "runtime" log level 2020-12-26 15:45:45 -05:00
msg.py Formatting 2021-04-28 12:23:08 -04:00