forked from goodboy/tractor
1
0
Fork 0
Commit Graph

934 Commits (ae682c0f19b1065dfc0e7ad8bdb4f1296cb75078)

Author SHA1 Message Date
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 7b149dd3e4 Add initial infected asyncio error propagation test 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 490a046f6b 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 8852dde810 Add `maybe_open_context()` an actor wide task-resource cache 2021-10-27 14:06:27 -04:00
goodboy 5dbe8e4b14
Merge pull request #241 from goodboy/trionics
Trionics
2021-10-27 13:09:11 -04:00
goodboy 9c13827a14
Merge pull request #256 from overclockworked64/241-news-fragment
Add a news fragment
2021-10-27 12:38:15 -04:00
overclockworked64 6da76949fd
Fix the syntax and point to the new package 2021-10-27 17:03:25 +02:00
overclockworked64 49dd230b4f
Add a newline 2021-10-25 20:01:21 +02:00
overclockworked64 c7f59bd483
Add a news fragment 2021-10-25 19:17:42 +02:00
Tyler Goodlet 083b73ad4a Test: don't grab debug lock if not in mode 2021-10-25 10:22:41 -04:00
goodboy 925af28092
Merge pull request #254 from goodboy/graceful_gather
Change to `gather_contexts()`, use event for graceful exit
2021-10-25 10:14:01 -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
goodboy ebf080b8a2
Merge pull request #253 from overclockworked64/fix-type-annotation
Fix type annotations
2021-10-23 19:09:11 -04:00
overclockworked64 50400359b8
Fix type annotations 2021-10-24 00:47:26 +02:00
goodboy 71b8f9f1ea
Merge pull request #252 from goodboy/246_facepalm_backup
Trionics improvements from @overclockworked64
2021-10-23 18:10:17 -04:00
overclockworked64 b91adcf38d Get rid of external teardown trigger 2021-10-23 16:17:30 -04: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 c1089dbd95 Add a clustering test 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
overclockworked64 76767a3d7e Add 'trio.trionics' to setup.py 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 8ba10315c1 Fix type path to new `_supervise` mod 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