forked from goodboy/tractor
1
0
Fork 0
Commit Graph

693 Commits (52f135d85d66e703b1ad495f0b1ee5aad3c7cfa0)

Author SHA1 Message Date
Tyler Goodlet 52f135d85d Avoid mutate on iterate race 2021-06-10 13:59:08 -04:00
Tyler Goodlet b29d2f7053 Only close recv chan if we get a ref 2021-06-10 13:58:06 -04:00
Tyler Goodlet 5960330413 Add error case 2021-06-10 13:57:16 -04:00
Tyler Goodlet 727a2084d6 Don't shield debugger status wait; it causes hangs 2021-06-02 08:24:59 -04:00
Tyler Goodlet f943ea0119 Drop bad .close() call 2021-06-02 08:22:51 -04:00
Tyler Goodlet cb2d2ed9d5 Proxy asyncio cancelleds as well 2021-05-31 09:29:45 -04:00
Tyler Goodlet 7b2543512c Power of 2 cuz puters 2021-05-31 09:29:45 -04:00
Tyler Goodlet 7d41492f53 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-05-31 09:29:45 -04:00
Tyler Goodlet bc468d9140 WIP redo asyncio async gen streaming 2021-05-31 09:29:45 -04:00
Tyler Goodlet bf21c90461 Support asyncio actors with the trio spawner backend 2021-05-31 09:29:45 -04:00
Tyler Goodlet 316667a41f 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-05-31 09:29:45 -04:00
Tyler Goodlet ad9ed19bce Support asyncio actors with the trio spawner backend 2021-05-31 09:29:28 -04:00
Tyler Goodlet 98a69f06b4 Support no arg to `Context.started()` like trio 2021-05-31 09:28:07 -04:00
Tyler Goodlet df420fcafc Export portal type at top level 2021-05-31 09:28:07 -04:00
Tyler Goodlet 6834abb46f Link to SC on wikipedia 2021-05-31 09:28:07 -04:00
Tyler Goodlet 72099985be Add per actor debug mode toggle 2021-05-31 09:28:07 -04:00
Tyler Goodlet b1d3e97697 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-05-31 09:28:07 -04:00
Tyler Goodlet d6b16cabbe Pass func refs 2021-05-31 09:27:40 -04:00
Tyler Goodlet 0f8699a96a Shush the linter 2021-05-31 09:27:40 -04:00
Tyler Goodlet 43d2439335 Add initial infected asyncio error propagation test 2021-05-31 09:27:40 -04:00
Tyler Goodlet 6476df2c69 Raise any asyncio errors if in trio task on cancel 2021-05-31 09:27:40 -04:00
Tyler Goodlet 762e6ad2a2 Raise from asyncio error; fixes mypy 2021-05-31 09:27:40 -04:00
Tyler Goodlet 6ae4d8699e Tweak log msg 2021-05-31 09:27:40 -04:00
Tyler Goodlet dd0cfe2f5a Log error 2021-05-31 09:27:40 -04:00
Tyler Goodlet 1f3de88422 Support asyncio actors with the trio spawner backend 2021-05-31 09:27:40 -04:00
Tyler Goodlet c34d4b54fd Revert removal of `infect_asyncio` in nursery start methods 2021-05-31 09:27:40 -04:00
Tyler Goodlet aed60dd7e2 Attempt to make mypy happy.. 2021-05-31 09:27:40 -04:00
Tyler Goodlet 5f0ed8e7bd Add an obnoxious error message on internal failures 2021-05-31 09:27:40 -04:00
Tyler Goodlet a9985c0c01 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-05-31 09:27:40 -04:00
Tyler Goodlet 940774f215 Drop entrypoints from `Actor` 2021-05-31 09:27:40 -04:00
Tyler Goodlet db15162f04 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-05-31 09:27:40 -04:00
Tyler Goodlet 9d4dba23a6 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-05-31 09:27:40 -04:00
Tyler Goodlet 24c6a65873 Add a @pub kwarg to allow specifying a "startup response message" 2021-05-31 09:27:10 -04:00
Tyler Goodlet 35465a5438 Catch and delay errors in the root if debugger is active 2021-05-31 09:26:26 -04:00
Tyler Goodlet 5b3f554f57 Don't shield on root cancel it can causes hangs 2021-05-31 09:26:17 -04:00
Tyler Goodlet 0d0e0bc2da Experiment: only disable SIGINT handling in children 2021-05-31 09:26:05 -04:00
Tyler Goodlet 19825ba284 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-05-31 09:25:47 -04:00
Tyler Goodlet 682ef3425f Add debug example that causes pdb stdin clobbering 2021-05-31 09:25:47 -04:00
Tyler Goodlet 4a16f03fe8 Fix up var naming and typing 2021-05-31 09:25:38 -04:00
Tyler Goodlet 63e13aefdb Only send stop msg if not received from far end 2021-05-31 09:25:38 -04:00
Tyler Goodlet bfa4410133 Expose msg stream types at top level 2021-05-31 09:25:38 -04:00
Tyler Goodlet 6f2fb9e47c Add dynamic pubsub test using new bidir stream apis 2021-05-31 09:25:38 -04:00
Tyler Goodlet 420cd8de13 Use context for remote debugger locking
A context is the natural fit (vs. a receive stream) for locking the root
proc's tty usage via it's `.started()` sync point. Simplify the
`_breakpoin()` routine to be a simple async func instead of all this
"returning a coroutine" stuff from before we decided that
`tractor.breakpoint()` must be async. Use `runtime` level for locking
logging making it easier to trace.
2021-05-31 09:25:38 -04:00
Tyler Goodlet 01bef653c2 Be more pedantic with error handling 2021-05-31 09:25:38 -04:00
Tyler Goodlet 899404932a Fix typing 2021-05-31 09:25:38 -04:00
Tyler Goodlet 49deef0d71 Parametrize with async for style tests 2021-05-31 09:25:38 -04:00
Tyler Goodlet e46ef8ae3f Support passing `shield` at stream contruction 2021-05-31 09:25:38 -04:00
Tyler Goodlet b5116c5a51 Add basic test set 2021-05-31 09:25:38 -04:00
Tyler Goodlet c6e52b0387 Cancel scope on stream consumer completion 2021-05-31 09:25:38 -04:00
Tyler Goodlet f792aa06b5 Expose `@context` decorator at top level 2021-05-31 09:25:38 -04:00