forked from goodboy/tractor
1
0
Fork 0
Commit Graph

523 Commits (c37eee6011e3a5868ada7b46110d2303d51b47d4)

Author SHA1 Message Date
Tyler Goodlet c37eee6011 Add breakpoint in parent example 2020-12-09 11:03:42 -05:00
Tyler Goodlet e637d9d23d Drop duplicate project-package name in msg header 2020-11-16 08:44:41 -05:00
Tyler Goodlet d345ba4f2f Raise from asyncio error; fixes mypy 2020-11-16 08:44:41 -05:00
Tyler Goodlet 0c3cd553d3 Tweak log msg 2020-11-16 08:44:41 -05:00
Tyler Goodlet ce5ed631e0 Log error 2020-11-16 08:44:41 -05:00
Tyler Goodlet f174aaf7d8 Drop uneeded parent cs cancel 2020-11-16 08:44:41 -05:00
Tyler Goodlet e830862181 Support asyncio actors with the trio spawner backend 2020-11-16 08:44:41 -05:00
Tyler Goodlet 8d9f0a12a4 Revert removal of `infect_asyncio` in nursery start methods 2020-11-16 08:44:41 -05:00
Tyler Goodlet a6963b2c6a Attempt to make mypy happy.. 2020-11-16 08:44:41 -05:00
Tyler Goodlet f0861b9d79 Add an obnoxious error message on internal failures 2020-11-16 08:44:41 -05:00
Tyler Goodlet a045ba489a Allow marking `asyncio` funcs declaring `to_trio` channel 2020-11-16 08:44:41 -05:00
Tyler Goodlet 0adcefcfd4 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.
2020-11-16 08:44:41 -05:00
Tyler Goodlet 270061508e Drop entrypoints from `Actor` 2020-11-16 08:44:41 -05:00
Tyler Goodlet 04794a1d8e 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).
2020-11-16 08:44:41 -05:00
Tyler Goodlet d5079558f7 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
2020-11-16 08:44:41 -05:00
Tyler Goodlet 3e47795305 Try not masking SIGINT in child processes 2020-11-16 00:07:43 -05:00
Tyler Goodlet 02b20dd97c Make SIGINT handler kill the process tree
The std lib's `pdb` internals override SIGINT handling whenever one
enters the debugger repl. Force a handler that kills the tree if SIGINT
is triggered from the root actor, otherwise igore it since supervised
children should be managed already. This resolves an issue with guest
mode where `pdb` causes SIGINTs to be swallowed resulting in the host
loop never terminating the process tree.
2020-11-16 00:01:21 -05:00
Tyler Goodlet 5f55c7ca00 Add `Actor.cancel_soon()` for sync self destruct
Add a sync method that can be used to cancel the current actor from
a synchronous context. This is useful in debugging situations where
sync debugger code may need to kill the process tree.

Also, make the internal "lifetime stack" a global var; easier to manage
from client code that may was to add callbacks prior to the actor
runtime being fully setup.
2020-11-15 23:54:42 -05:00
goodboy 2674c54c0b
Merge pull request #162 from goodboy/debug_refine
Debug refine
2020-10-15 23:31:08 -04:00
Tyler Goodlet a8406c8626 Toss in another tests with daemon subactors 2020-10-15 23:16:56 -04:00
Tyler Goodlet 1580cc6fa0 Add explanation to module load error 2020-10-15 23:16:56 -04:00
Tyler Goodlet 5822d38ae4 Set _is_root runtime var in _main() 2020-10-15 23:16:54 -04:00
goodboy 7ddc4db041
Merge pull request #161 from goodboy/drop_warn
Drop warn
2020-10-14 14:15:50 -04:00
Tyler Goodlet bd34140a5f Revert "Try out sync sleep on windows again"
Nope, still doesn't work...

This reverts commit 676cdafa8f.
2020-10-14 14:06:04 -04:00
Tyler Goodlet 3b8684f655 Always call `Actor.cancel()` at end of root's main task
It's simpler and the only real logical difference is logging messages.
This should also give us an overall consistent tear down sequence.
2020-10-14 13:59:57 -04:00
Tyler Goodlet 676cdafa8f Try out sync sleep on windows again 2020-10-14 13:48:41 -04:00
Tyler Goodlet 02a9cac557 Drop remaining warn()s 2020-10-14 13:48:14 -04:00
Tyler Goodlet f60321a35a Always cancel service nursery last
The channel server should be torn down *before* the rpc
task/service nursery. Do this explicitly even in the root's main task
to avoid a strange hang I found in the pubsub tests. Start dropping
the `warnings.warn()` usage.
2020-10-14 13:46:05 -04:00
goodboy 7115d6c3bd
Merge pull request #129 from goodboy/multiproc_debug
Wen? Multiprocessing-native debugger now!
2020-10-14 09:14:03 -04:00
Tyler Goodlet 61a8df358c Comments tweak 2020-10-14 09:06:40 -04:00
Tyler Goodlet bba47e4c7a Add gh actions badge 2020-10-13 21:45:54 -04:00
Tyler Goodlet 1c25f25ab0 Drop travisCI; it's slower and has worse windows support. 2020-10-13 21:27:17 -04:00
Tyler Goodlet 0177268f13 Report on skipped tests 2020-10-13 16:30:19 -04:00
Tyler Goodlet 1b6ee2ecf6 Skip sync sleep test on windows 2020-10-13 15:26:46 -04:00
Tyler Goodlet 15edcc622d Skip it on windows too 2020-10-13 15:13:46 -04:00
Tyler Goodlet fd59f4ad16 On windows .spawn dne? 2020-10-13 14:56:26 -04:00
Tyler Goodlet a934eb063c Factor `repodir()` helper into conftest.py 2020-10-13 14:49:31 -04:00
Tyler Goodlet a49deb46f1 Revert "Make tests a package (for relative imports)"
This reverts commit 1710b642a5.
2020-10-13 14:42:16 -04:00
Tyler Goodlet 666966097a Revert "Change to relative conftest.py imports"
This reverts commit 2b53c74b1c.
2020-10-13 14:42:02 -04:00
Tyler Goodlet e3c26943ba Support debug mode only on the trio backend 2020-10-13 14:20:44 -04:00
Tyler Goodlet ba52de79e1 Skip quad ex on local mp tests as well 2020-10-13 14:20:19 -04:00
Tyler Goodlet 24ef919334 Skip sync sleep test on mp backend 2020-10-13 14:16:20 -04:00
Tyler Goodlet 08ff989631 Add some comments 2020-10-13 11:59:18 -04:00
Tyler Goodlet 573b8fef73 Add better actor cancellation tracking
Add `Actor._cancel_called` and `._cancel_complete` making it possible to
determine whether the actor has started the cancellation sequence and
whether that sequence has fully completed. This allows for blocking in
internal machinery tasks as necessary. Also, always trigger the end of
ongoing rpc tasks even if the last task errors; there's no guarantee the
trio cancellation semantics will guarantee us a nice internal "state"
without this.
2020-10-13 11:48:52 -04:00
Tyler Goodlet 0ce6d2b55c Add `pexpect` dep for debugger tests 2020-10-13 11:04:16 -04:00
Tyler Goodlet c375a2d028 mypy fixes 2020-10-13 11:03:55 -04:00
Tyler Goodlet 1710b642a5 Make tests a package (for relative imports) 2020-10-13 10:50:21 -04:00
Tyler Goodlet c41e5c8313 Fix missing await 2020-10-13 00:45:29 -04:00
Tyler Goodlet a88a6ba7a3 Add pattern matching to test 2020-10-13 00:36:34 -04:00
Tyler Goodlet 79c38b04e7 Report `trio.Cancelled` when exhausting portals..
For reliable remote cancellation we need to "report" `trio.Cancelled`s
(just like any other error) when exhausting a portal such that the
caller can make decisions about cancelling the respective actor if need
be.

Resolves #156
2020-10-12 23:28:36 -04:00