Commit Graph

1252 Commits (925d5c1cebe8f037bb0b290e33400b7b373fef6a)

Author SHA1 Message Date
Tyler Goodlet f81e802219 Support `loglevel` fixture injection
For `pytest`, support defining a `loglevel` fixture value which will be
passed into internals when using `@tractor_test`.
2018-11-30 01:11:08 -05:00
goodboy 58ebacf0f7
Merge pull request #45 from tgoodlet/expose_tractor_test
Expose `tractor_test` for external use
2018-11-26 14:42:24 -05:00
Tyler Goodlet 321c096496 Add testing sub-pkg 2018-11-26 14:16:29 -05:00
Tyler Goodlet 512a2f25a2 Expose `tractor_test` in the same way as `trio` 2018-11-26 11:26:04 -05:00
Tyler Goodlet 0879150399 Move `tractor_test` to new module 2018-11-26 11:20:53 -05:00
goodboy b0f7e6a954
Merge pull request #42 from tgoodlet/improved_errors
Improved errors - introduce trio.MultiError
2018-11-22 14:56:11 -05:00
Tyler Goodlet 23c7519fec Jeeze 3.7.1 got even faster? 2018-11-22 14:25:31 -05:00
Tyler Goodlet a482681f9c Leverage `pytest.raises()` better; fix a bunch of docs 2018-11-22 11:43:04 -05:00
Tyler Goodlet 469a1e5874 Pin to trio 0.8+ 2018-11-19 18:43:38 -05:00
Tyler Goodlet 3e74cc6f11 Verify nested boxed errors 2018-11-19 16:53:21 -05:00
Tyler Goodlet 0a240187c6 Log the exception when unable to ship back rpc errors 2018-11-19 16:52:55 -05:00
Tyler Goodlet 7a2b7d9d14 Delay tweak for py3.7.1 2018-11-19 14:17:01 -05:00
Tyler Goodlet 9102c48810 Add multierror cancellation tests 2018-11-19 14:16:42 -05:00
Tyler Goodlet 82fcf025cc Fix: MultiError isn't an Exception... 2018-11-19 14:16:09 -05:00
Tyler Goodlet 1bb37dbddf Expose trio.MultiError publicly 2018-11-19 14:15:28 -05:00
Tyler Goodlet 9bb8a062eb mypy fixes 2018-11-19 08:47:42 -05:00
Tyler Goodlet 835d1fa07a Vastly improve error triggered cancellation
At the expense of a bit more complexity in `ActorNursery.wait()`
(which I commented the heck out of fwiw) this adds far superior and
correct cancellation semantics for when a nursery is cancelled due
to (remote) errors in subactors.

This includes:
- `wait()` will now raise a `trio.MultiError` if multiple subactors
  error with the same semantics as in `trio`.
- in `wait()` portals which are paired with `run_in_actor()`
  spawned subactors (versus `start_actor()`) are waited on separately
  and if the nursery **hasn't** been cancelled but there are errors
  those are raised immediately before waiting on `start_actor()`
  subactors which will block indefinitely if they haven't been
  explicitly cancelled.
- if `wait()` does raise when the nursery hasn't yet been cancelled
  it's expected that it will be called again depending on the actor
  supervision strategy (i.e. right now we operate with a one-cancels-all
  strategy, the same as `trio`, so `ActorNursery.__aexit__() calls
  `cancel()` if any error is raised by `wait()`).

Oh and I added `is_main_process()` helper; can't remember why..
2018-11-19 08:44:19 -05:00
Tyler Goodlet e75b25dc21 Improve error propagation machinery
Use the new custom error types throughout the actor and portal
primitives and set a few new rules:
- internal errors are any error not raised by an rpc task and are
  **not** forwarded to portals but instead are raised directly in
  the msg loop.
- portals always re-raise a "main task" error for every call to
  ``Portal.result()``.
2018-11-19 04:05:07 -05:00
Tyler Goodlet 2f6609ab78 Add custom exceptions with msg (un)packing 2018-11-19 03:51:12 -05:00
Tyler Goodlet 71bb87aa3a Drop deprecated trio error 2018-11-09 01:53:15 -05:00
Tyler Goodlet 12fa5542b1 Oh, mypy... 2018-11-09 01:52:57 -05:00
Tyler Goodlet 2ce8e06619 Some minor doc/comment tweaks 2018-11-09 01:40:12 -05:00
Tyler Goodlet aa32f42715 Avoid hanging multi-prog test when SIGINT fails 2018-11-09 01:36:45 -05:00
Tyler Goodlet aa8238d5e0 Revert allowing multiple stream handlers; clutters test output 2018-11-09 01:35:51 -05:00
goodboy 8b7bf4fc07
Merge pull request #39 from tgoodlet/self_register
Verify arbiter self registration works
2018-09-21 10:18:17 -04:00
Tyler Goodlet 109b5971ed Don't overload `func` arg 2018-09-21 10:11:27 -04:00
Tyler Goodlet 034146f2b1 Verify arbiter self registration 2018-09-21 00:32:23 -04:00
Tyler Goodlet 2973d7f1de Await async funcs properly in `LocalPortal.run()` 2018-09-21 00:31:30 -04:00
Tyler Goodlet 71b44b997e Drop sillyness in intro 2018-09-20 20:30:57 -04:00
Tyler Goodlet 7dd91d0684 Wait longer for arbiter-daemon to spawn on py3.6 2018-09-17 09:17:11 -04:00
Tyler Goodlet 65beb2d84e Top level actor must have a `main()` now 2018-09-14 16:34:13 -04:00
Tyler Goodlet 716a44b6b8 Better document `run_daemon()` 2018-09-14 16:33:45 -04:00
goodboy 85a5d1f849
Merge pull request #38 from tgoodlet/multi_program_tests
Multi program tests
2018-09-10 22:43:39 -04:00
Tyler Goodlet 827a6c6014 Make `rpc_modules` a positional arg to `tractor.run_daemon()` 2018-09-10 22:31:23 -04:00
Tyler Goodlet 037c4c3797 Comment tweak 2018-09-10 15:28:19 -04:00
Tyler Goodlet d808ffd8f3 `Logger.warn()` is deprecated 2018-09-10 15:19:49 -04:00
Tyler Goodlet d12136d44d Add some mult-program tests
Run the arbiter-actor in a separate program and do some basic tests to
make sure everything works - particularly, registration and
cancellation.
2018-09-08 09:44:29 -04:00
Tyler Goodlet ee7959cb55 Fix same named actor race
When an actor has already been registered with the arbiter it should
exist in the registry and thus the wait event should have been removed.
Check that the registry indeed holds an event before clearing it.
2018-09-08 09:40:35 -04:00
Tyler Goodlet 6b8393a4d6 Add `tractor.run_daemon()` for running a main rpc daemon 2018-09-08 09:39:53 -04:00
Tyler Goodlet 0ca668453c Running without a main func is a type error 2018-09-05 18:13:23 -04:00
Tyler Goodlet 914d1b67d8 Fix typo 2018-09-04 22:17:12 -04:00
Tyler Goodlet a998a5e415 Forgot to remove spawn tests from test_local.py 2018-09-04 22:17:02 -04:00
goodboy 6dfbdd33a1
Merge pull request #37 from tgoodlet/tests_reorg
Tests reorg
2018-09-03 16:22:44 -04:00
Tyler Goodlet c2457f7cce Move basic spawning tests to separate module 2018-09-02 22:07:32 -04:00
Tyler Goodlet 18e101d38e Move streaming tests into separate module 2018-09-02 21:58:42 -04:00
Tyler Goodlet 51076ebb5c Break cancellation tests into new module 2018-09-02 11:51:58 -04:00
Tyler Goodlet 438a79707f Couple more type tweaks 2018-09-01 14:43:48 -04:00
Tyler Goodlet 3dcf16c43d Min cancel delay >= 0 2018-08-31 20:38:34 -04:00
goodboy 22ac567230
Merge pull request #35 from tgoodlet/type_annotations
Add type annotations to most functions
2018-08-31 20:04:39 -04:00
Tyler Goodlet 4d63125a3c Add mypy checking to CI! 2018-08-31 18:06:16 -04:00