Commit Graph

526 Commits (func_refs_always)

Author SHA1 Message Date
Tyler Goodlet 4bf9b27f57 Drop all .statespace refs; it was a silly idea 2020-12-22 19:33:16 -05:00
Tyler Goodlet 0eba5f4708 Port remaining tests to pass func refs 2020-12-22 10:39:47 -05:00
Tyler Goodlet 493f2efb50 Port tests to `Portal.run_from_ns()` 2020-12-22 10:39:47 -05:00
Tyler Goodlet 9fd3c42eb1 Port inter-process method calls to `Portal.run_from_ns()` 2020-12-22 10:39:47 -05:00
Tyler Goodlet 7134f35d6e Add `Portal.run_from_ns()`
It turns out in order to maintain our sneaky little "call an `Actor`
method in this remote process" we still need the ability to invoke
functions from a namespace. We're currently using a "self" namespace as
a way to do this for internal inter-process method calling.  Either way,
I see no reason not to keep a public method for this invoke style (we
just won't market it) since it is still how the machinery works
underneath.
2020-12-22 10:39:47 -05:00
Tyler Goodlet a668f714d5 Allow passing function refs to `Portal.run()`
This resolves and completes #69 allowing all RPC invocation APIs to pass
function references directly instead of explicit `str` names for the
target namespace and function (this is still done implicitly
underneath).  This brings us closer to `trio`'s task running API as well
as acknowledges that any inter-host RPC system (and API) will likely
need to be implemented on top of local RPC primitives anyway. Even if
this ends up **not** being true we can always go to "function stubs" as
part of our IAC protocol or, add a new method to do explicit namespace
calls: `.run_from_module()` or whatever everyone votes on.

Resolves #69

Further, this commit drops `Actor.statespace` from the entire system
since a user can easily get this same functionality using module
level variables. Fix docs to match all these changes (luckily mostly
already done due to example scripts referencing).
2020-12-21 09:09:55 -05:00
goodboy c3b209fa4f
Merge pull request #173 from goodboy/fix_debug_tests_in_ci_again
Fix debug tests in ci again
2020-12-19 00:06:29 -05:00
Tyler Goodlet dc475b54ab More obnoxious CI timeout handling 2020-12-18 19:26:29 -05:00
Tyler Goodlet 0d67ce4abc Fix collections type import for py3.10 2020-12-18 17:58:07 -05:00
Tyler Goodlet a95488ad2f Handle pexpect's internal timeout 2020-12-18 17:57:44 -05:00
goodboy 1701493087
Merge pull request #171 from goodboy/stream_channel_shield
Add a way to shield a stream's underlying channel
2020-12-18 11:17:08 -05:00
Tyler Goodlet 47f68a0532 Skip debugger tests on non-trio backends 2020-12-17 16:37:05 -05:00
Tyler Goodlet 797bcc1df2 Handle early timeouts on last debugger test 2020-12-17 13:35:45 -05:00
Tyler Goodlet 201771a521 'Fix mypy, change interal type name to `ReceiveStream`, settle on `.shield()`' 2020-12-17 12:01:49 -05:00
Tyler Goodlet 15ead6b561 Add a way to shield a stream's underlying channel
Add a ``tractor._portal.StreamReceiveChannel.shield_channel()`` context
manager which allows for avoiding the closing of an IPC stream's
underlying channel for the purposes of task re-spawning. Sometimes you
might want to cancel a task consuming a stream but not tear down the IPC
between actors (the default). A common use can might be where the task's
"setup" work might need to be redone but you want to keep the
established portal / channel in tact despite the task restart.

Includes a test.
2020-12-16 21:42:28 -05:00
goodboy a510eb0b2b
Merge pull request #170 from goodboy/pdb_madness
End the `pdb` SIGINT handling madness
2020-12-12 14:53:31 -05:00
Tyler Goodlet 0118589875 Add race case handling for mp backend 2020-12-12 13:30:14 -05:00
Tyler Goodlet d497078eb7 Appease 3.8 mypy 2020-12-11 20:04:56 -05:00
Tyler Goodlet e51c2620e5 End the `pdb` SIGINT handling madness
Turns out this is a lower level issue in terms of the stdlib's default
`pdb.Pdb` settings and how they conflict with `trio`s cancellation and
KBI handling. The details are hashed out more thoroughly in
python-trio/trio#1155. Maybe we can get a fix in trio so things are
solved under our feet :)
2020-12-11 00:15:09 -05:00
goodboy e27dc2e244
Merge pull request #164 from goodboy/clean_log_header
Drop duplicate project-package name in msg header
2020-12-09 10:25:31 -05:00
Tyler Goodlet 12f425137c Drop duplicate project-package name in msg header 2020-11-03 12:15:49 -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