Commit Graph

72 Commits (e5ee2e3de824fbe8648fb79e6ca7c245db599a78)

Author SHA1 Message Date
Tyler Goodlet 9b07e9ad7c Yield results on demand using a mem chan 2021-02-21 14:08:23 -05:00
Tyler Goodlet 3c320f467f Remove use of tractor.run() 2021-02-21 14:08:23 -05:00
Tyler Goodlet 2555765882 Make new paralellism example space 2021-02-21 14:08:23 -05:00
Tyler Goodlet 7db5739143 Add our version of the std lib's "worker pool"
This is a draft of the `tractor` way to implement the example from the
"processs pool" in the stdlib's `concurrent.futures` docs:

https://docs.python.org/3/library/concurrent.futures.html#processpoolexecutor-example

Our runtime is of course slower to startup but once up we of course get
the same performance, this confirms that we need to focus some effort
not on warm up and teardown times.  The mp forkserver method definitely
improves startup delay; rolling our own will likely be a good hot spot
to play with.

What's really nice is our implementation is done in approx 10th the code ;)

Also, do we want offer and interface that yields results as they arrive?

Relates to #175
2021-02-21 14:08:23 -05:00
Tyler Goodlet 14d60147fa Add an example which breaks shielded proc waits 2021-01-14 18:21:26 -05:00
Tyler Goodlet 5127effd88 Drop warning level logging assert(s) 2020-12-26 15:45:55 -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
Tyler Goodlet 0118589875 Add race case handling for mp backend 2020-12-12 13:30:14 -05:00
Tyler Goodlet a8406c8626 Toss in another tests with daemon subactors 2020-10-15 23:16:56 -04:00
Tyler Goodlet acb4cb0b2b Add test showing issue with child in tty lock when cancelled 2020-10-07 06:08:31 -04:00
Tyler Goodlet abf8bb2813 Add a deep nested error propagation test 2020-10-06 09:21:53 -04:00
Tyler Goodlet 371025947a Add a multi-subactor test where the root errors 2020-10-05 11:58:58 -04:00
Tyler Goodlet 31c1a32d58 Add re-entrant root breakpoint test; demonstrates a bug.. 2020-10-05 11:58:58 -04:00
Tyler Goodlet e387e8b322 Add a multi-subactor test with nesting 2020-10-05 11:58:58 -04:00
Tyler Goodlet 73a32f7d9c Add initial subactor debug tests 2020-10-05 11:58:58 -04:00
Tyler Goodlet 0a2a94fee0 Add initial root actor debugger tests 2020-10-05 11:58:58 -04:00
Tyler Goodlet 20f9ccfa9e Move two more examples out of docs for testing 2020-02-10 12:14:16 -05:00
Tyler Goodlet 802f47b4ca Drop uneeded import 2020-02-10 12:14:16 -05:00
Tyler Goodlet f2030a2714 Better document the window's gotcha solution in test code 2020-02-09 14:59:22 -05:00
Tyler Goodlet 7880934505 Add tests for all docs examples
Parametrize our docs example test to include all (now fixed) examples
from the `READ.rst`. The examples themselves have been fixed/corrected
to run but they haven't yet been updated in the actual docs. Once #99
lands these example scripts will be directly included in our
documentation so there will be no possibility of presenting incorrect
examples to our users! This technically fixes #108 even though the new
example aren't going to be included directly in our docs until #99
lands.
2020-02-09 02:01:39 -05:00
Tyler Goodlet 70636a98f6 Use the windows "gotchcas" fix for example tests
Apply the fix from @chrizzFTD where we invoke the entry point using
module exec mode on a ``__main__.py`` and import the
``test_example::`main()` from within that entry point script.
2020-02-09 01:07:07 -05:00
Tyler Goodlet c6f3ab5ae2 Initial examples testing attempt
A per #98 we need tests for examples from the docs as they would be run
by a user copy and pasting the code. This adds a small system for loading
examples from an "examples/" directory and executing them in
a subprocess while checking the output. We can use this to also verify
end-to-end expected logging output on std streams (ex. logging on
stderr).

To expand this further we can parameterize the test list using the
contents of the examples directory instead of hardcoding the script
names as I've done here initially.

Also, fix up the current readme examples to have the required/proper `if
__name__ == '__main__'` script guard.
2020-02-07 19:36:52 -05:00