1
0
Fork 0
Commit Graph

484 Commits (a0b885e9d7c7e948d2a221c464d6bc260f7ca2ea)

Author SHA1 Message Date
Tyler Goodlet a0b885e9d7 First draft: `.to_asyncio.open_channel_from()` 2021-10-27 16:06:44 -04:00
Tyler Goodlet b7d5ff79b4 Always cancel the asyncio task? 2021-10-27 16:06:44 -04:00
Tyler Goodlet 60b892cc80 WIP, add back in root shield, print out pdb sigint opts 2021-10-27 16:06:44 -04:00
Tyler Goodlet cbc18f94ec Drop old implementation cruft 2021-10-27 16:06:44 -04:00
Tyler Goodlet e016884ce0 Fix error propagation on asyncio streaming tasks 2021-10-27 16:06:44 -04:00
Tyler Goodlet d42f628597 Drop bad .close() call 2021-10-27 16:06:44 -04:00
Tyler Goodlet a572fde6c6 Proxy asyncio cancelleds as well 2021-10-27 16:06:44 -04:00
Tyler Goodlet 8805cbee3d Don't kill root's immediate children when in debug
If the root calls `trio.Process.kill()` on immediate child proc teardown
when the child is using pdb, we can get stdstreams clobbering that
results in a pdb++ repl where the user can't see what's been typed. Not
killing such children on cancellation / error seems to resolve this
issue whilst still giving reliable termination. For now, code that
special path until a time it becomes a problem for ensuring zombie
reaps.
2021-10-27 16:06:44 -04:00
Tyler Goodlet 004722914b WIP redo asyncio async gen streaming 2021-10-27 16:06:44 -04:00
Tyler Goodlet 1e2d43b0d6 Support asyncio actors with the trio spawner backend 2021-10-27 16:06:44 -04:00
Tyler Goodlet 948be9b069 Support sync code breakpointing via built-in
Override `breakpoint()` for sync code making it work
properly with `trio` as per:

https://github.com/python-trio/trio/issues/1155#issuecomment-742964018

Relates to #193
2021-10-27 16:06:44 -04:00
Tyler Goodlet 2fbc4caacb Support asyncio actors with the trio spawner backend 2021-10-27 16:06:44 -04:00
Tyler Goodlet 2c52530ef0 Add per actor debug mode toggle 2021-10-27 16:06:44 -04:00
Tyler Goodlet ae682c0f19 Support sync code breakpointing via built-in
Override `breakpoint()` for sync code making it work
properly with `trio` as per:

https://github.com/python-trio/trio/issues/1155#issuecomment-742964018

Relates to #193
2021-10-27 16:06:44 -04:00
Tyler Goodlet cabc41fcfa Pass func refs 2021-10-27 16:06:44 -04:00
Tyler Goodlet 2cf98d5e09 Raise any asyncio errors if in trio task on cancel 2021-10-27 16:06:44 -04:00
Tyler Goodlet 81cd21c04b Raise from asyncio error; fixes mypy 2021-10-27 16:06:44 -04:00
Tyler Goodlet bba03654ea Tweak log msg 2021-10-27 16:06:44 -04:00
Tyler Goodlet d337a54fb6 Log error 2021-10-27 16:06:44 -04:00
Tyler Goodlet ac5b3628d2 Support asyncio actors with the trio spawner backend 2021-10-27 16:06:44 -04:00
Tyler Goodlet a6b6241176 Revert removal of `infect_asyncio` in nursery start methods 2021-10-27 16:06:44 -04:00
Tyler Goodlet e54ddac5b9 Attempt to make mypy happy.. 2021-10-27 16:06:44 -04:00
Tyler Goodlet d17774b2b0 Add an obnoxious error message on internal failures 2021-10-27 16:06:44 -04:00
Tyler Goodlet 5c31281557 Wow, fix all the broken async func invoking code..
Clearly this wasn't developed against a task that spawned just an async
func in `asyncio`.. Fix all that and remove a bunch of unnecessary func
layers. Add provisional support for the target receiving the `to_trio`
and `from_trio` channels and for the @tractor.stream marker.
2021-10-27 16:06:44 -04:00
Tyler Goodlet dee6c987a9 Drop entrypoints from `Actor` 2021-10-27 16:06:44 -04:00
Tyler Goodlet d4699b987b Move asyncio guest mode entrypoint to `to_asyncio`
The function is useful if you want to run the "main process" under
`asyncio`. Until `trio` core wraps this better we'll keep our own copy
in the interim (there's a new "inside-out-guest" mode almost on
mainline so hang tight).
2021-10-27 16:06:44 -04:00
Tyler Goodlet 60739ce571 Propagate any spawned `asyncio` task error upwards
This should mostly maintain top level SC principles for any task spawned
using `tractor.to_asyncio.run()`. When the `asyncio` task completes make
sure to cancel the pertaining `trio` cancel scope and raise any error
that may have resulted.

Resolves #120
2021-10-27 16:06:44 -04:00
Tyler Goodlet 417cebe827 Add a @pub kwarg to allow specifying a "startup response message" 2021-10-27 16:06:44 -04:00
Tyler Goodlet 8852dde810 Add `maybe_open_context()` an actor wide task-resource cache 2021-10-27 14:06:27 -04:00
Tyler Goodlet 083b73ad4a Test: don't grab debug lock if not in mode 2021-10-25 10:22:41 -04:00
Tyler Goodlet d0f5c7a5e2 Change to `gather_contexts()`, use event for graceful exit
The api we've made here is actually closer to `asyncio.gather()` but
with opening async context managers instead of funcs. Use another event
to allow for graceful teardown of children on non-cancellation exits
and add a doc string.
2021-10-24 14:00:01 -04:00
overclockworked64 50400359b8
Fix type annotations 2021-10-24 00:47:26 +02:00
overclockworked64 87e3d32992 Get rid of external teardown trigger because #245 resolves the problem 2021-10-23 16:17:30 -04:00
overclockworked64 04895b9d5e Get rid of dumb random uid and use current actor's uid 2021-10-23 16:17:30 -04:00
overclockworked64 b7a4641674 Allow specifying start_method and hard_kill 2021-10-23 16:17:30 -04:00
overclockworked64 3130a04c61 Rename a variable and fix type annotations 2021-10-23 16:17:29 -04:00
overclockworked64 6f9229cd09 Cancel nursery 2021-10-23 16:17:29 -04:00
overclockworked64 6e6baf250b Make sure the ID is a str 2021-10-23 16:17:29 -04:00
overclockworked64 73cbb2388a Avoid RuntimeError by not using current_actor's uid 2021-10-23 16:17:29 -04:00
overclockworked64 2815f1c343 Make 'async_enter_all' take a teardown trigger which '_enter_and_wait' will wait on 2021-10-23 16:17:29 -04:00
overclockworked64 21afc69ac7 Postpone evaluation of annotations 2021-10-23 16:17:29 -04:00
overclockworked64 7d502cef74 Add 'open_actor_cluster' to __all__ 2021-10-23 16:17:29 -04:00
Tyler Goodlet c372367cc2 Fix *args-like type annot 2021-10-23 15:54:40 -04:00
Tyler Goodlet 9ddd75733c Lul, fix everything for cluster helper 2021-10-23 15:54:40 -04:00
Tyler Goodlet 97006c904c Expose `Lagged` for broadcasting 2021-10-23 15:54:40 -04:00
Tyler Goodlet 79fb1d0ebc Fix top level nursery import 2021-10-23 15:54:40 -04:00
Tyler Goodlet 1e917fdb1d Add an async actor cluster spawner prototype 2021-10-23 15:54:40 -04:00
Tyler Goodlet 4114eb1d25 Move broadcast channel parts into trionics 2021-10-23 15:54:40 -04:00
Tyler Goodlet 680a841282 Start `trionics` sub-pkg with `async_enter_all()`
Since it seems we're building out more and more higher level primitives
in order to support certain parallel style actor trees and messaging
patterns (eg. task broadcast channels), we might as well start a new
sub-package for purely `trio` constructions. We hereby dub this
the realm of `trionics` (like electronics but for trios instead of
electrons).

To kick things off, add an `async_enter_all()` concurrent
exit-stack-like context manager API which will concurrently spawn
a sequence of provided async context managers and deliver their ordered
results but with proper support for `trio` cancellation semantics.
The stdlib's `AsyncExitStack` is not compatible with nurseries not
`trio` tasks (which are cancelled) since as task will be suspended on
the stack after push and does not ever hit a checkpoint until the stack
is closed.
2021-10-23 15:54:40 -04:00
Tyler Goodlet 340ddba4ae Rename the nursery module to `_supervise` 2021-10-23 15:54:40 -04:00