Commit Graph

853 Commits (msgspec_infect_asyncio)

Author SHA1 Message Date
Tyler Goodlet 57edf481e8 Always raise asyncio errors 2021-09-08 07:46:55 -04:00
Tyler Goodlet d6ddc47e58 Test non-shielding root lock acquire on breakpoint entry 2021-09-08 07:46:55 -04:00
Tyler Goodlet 86f4f2df6f Drop old implementation cruft 2021-09-08 07:46:55 -04:00
Tyler Goodlet 2bd5ba76b9 Fix error propagation on asyncio streaming tasks 2021-09-08 07:46:55 -04:00
Tyler Goodlet a4859c969c Drop bad .close() call 2021-09-08 07:46:55 -04:00
Tyler Goodlet 2dfa12c743 Proxy asyncio cancelleds as well 2021-09-08 07:46:55 -04:00
Tyler Goodlet f812c344a7 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-09-08 07:46:55 -04:00
Tyler Goodlet e161f7bac0 WIP redo asyncio async gen streaming 2021-09-08 07:46:55 -04:00
Tyler Goodlet 3fd28ee3a5 Support asyncio actors with the trio spawner backend 2021-09-08 07:46:55 -04:00
Tyler Goodlet 8dba692ef5 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-09-08 07:46:55 -04:00
Tyler Goodlet 673aeef4e9 Support asyncio actors with the trio spawner backend 2021-09-08 07:46:55 -04:00
Tyler Goodlet 9e6f75a592 Link to SC on wikipedia 2021-09-08 07:46:55 -04:00
Tyler Goodlet 76f9ff608c Add per actor debug mode toggle 2021-09-08 07:46:55 -04:00
Tyler Goodlet cbdf23ee6b 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-09-08 07:46:55 -04:00
Tyler Goodlet cb43c4c428 Pass func refs 2021-09-08 07:46:55 -04:00
Tyler Goodlet f154f492fc Add initial infected asyncio error propagation test 2021-09-08 07:46:55 -04:00
Tyler Goodlet 0802736095 Raise any asyncio errors if in trio task on cancel 2021-09-08 07:46:55 -04:00
Tyler Goodlet 68e5c2a95f Raise from asyncio error; fixes mypy 2021-09-08 07:46:55 -04:00
Tyler Goodlet 2adb59f40f Tweak log msg 2021-09-08 07:46:55 -04:00
Tyler Goodlet 0bac1f3021 Log error 2021-09-08 07:46:55 -04:00
Tyler Goodlet 25c19b9274 Support asyncio actors with the trio spawner backend 2021-09-08 07:46:55 -04:00
Tyler Goodlet 86089800ab Revert removal of `infect_asyncio` in nursery start methods 2021-09-08 07:46:55 -04:00
Tyler Goodlet 92594d8222 Attempt to make mypy happy.. 2021-09-08 07:46:55 -04:00
Tyler Goodlet 45a743cdd4 Add an obnoxious error message on internal failures 2021-09-08 07:46:55 -04:00
Tyler Goodlet a2d119ab56 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-09-08 07:46:55 -04:00
Tyler Goodlet 24a63415ef Drop entrypoints from `Actor` 2021-09-08 07:46:55 -04:00
Tyler Goodlet 9b7a4a1cd5 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-09-08 07:46:55 -04:00
Tyler Goodlet d55671f68b 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-09-08 07:46:55 -04:00
Tyler Goodlet 38d4fe31ac Add a @pub kwarg to allow specifying a "startup response message" 2021-09-08 07:46:55 -04:00
Tyler Goodlet 73f814e0d8 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-09-08 07:46:55 -04:00
Tyler Goodlet e8b282810e Add fragment 2021-09-07 21:37:57 -04:00
Tyler Goodlet 22383d1ed9 Add `msgspec` mentions to readme 2021-09-07 21:27:05 -04:00
Tyler Goodlet 0d41f1410f Add a stream type factory 2021-09-07 21:07:33 -04:00
Tyler Goodlet 6cf4a80fe4 Don't expect list value from registry 2021-09-07 20:25:40 -04:00
Tyler Goodlet c188008844 Ugh, appease mypy yet again 2021-09-07 20:24:02 -04:00
Tyler Goodlet 593fd24a9e Attempt to gracefully handle channel breakage? 2021-09-07 16:59:40 -04:00
Tyler Goodlet bb8452dbdb Ensure tuple for passed in arbiter addr 2021-09-06 12:07:09 -04:00
Tyler Goodlet 82999d10df Pin to latest and greatest `msgspec` 2021-09-06 11:53:50 -04:00
Tyler Goodlet a085111173 Call registry getter method in test 2021-09-06 11:53:50 -04:00
Tyler Goodlet c46bf6b3c4 Cast `defaultdict` to `dict` for registry get 2021-09-06 11:53:50 -04:00
Tyler Goodlet b8b264ae54 Map broken stream errs to transport closed; msgspec seems to be racy 2021-09-05 18:48:25 -04:00
Tyler Goodlet c27b00687c Convert actor UIDs to hashable tuples
`msgspec` sends python lists over the wire
(https://github.com/jcrist/msgspec/issues/30) which is fine and dandy
but we use them as lookup keys so we need to be sure we tuple-cast
first.
2021-09-05 18:27:50 -04:00
Tyler Goodlet fa6d9bef52 Fix log levels 2021-09-05 16:29:16 -04:00
Tyler Goodlet bdde646d4c Add msgspec installs, drop py3.7 2021-09-05 16:26:36 -04:00
Tyler Goodlet 7d0541d864 Mypy fixes to enforce uid tuple 2021-09-05 16:26:36 -04:00
Tyler Goodlet 7888de6070 Fix py version classifier 2021-09-05 16:26:36 -04:00
Tyler Goodlet 3b2598a060 Pkg `msgpec` as optional dep, load transport type if importable 2021-09-05 16:26:34 -04:00
Tyler Goodlet eb44244f24 Accept transport closed error during handshake and msg loop 2021-09-05 16:25:41 -04:00
Tyler Goodlet 7b902b7e9c Drop happy eyeballs inf delay 2021-09-05 16:23:33 -04:00
Tyler Goodlet fdd2da238a Add our own "transport closed" signal
This change some super old (and bad) code from the project's very early
days. For some redic reason i must have thought masking `trio`'s
internal stream / transport errors and a TCP EOF as `StopAsyncIteration`
somehow a good idea. The reality is you probably
want to know the difference between an unexpected transport error
and a simple EOF lol. This begins to resolve that by adding our own
special `TransportClosed` error to signal the "graceful" termination of
a channel's underlying transport. Oh, and this builds on the `msgspec`
integration which helped shed light on the core issues here B)
2021-09-05 16:23:10 -04:00