Commit Graph

899 Commits (302079341556bcd3d6467ad3227ce06c732b27c2)

Author SHA1 Message Date
overclockworked64 3020793415
Get rid of external teardown trigger because #245 resolves the problem 2021-10-22 03:03:41 +02:00
overclockworked64 14a7a129bd
Get rid of dumb random uid and use current actor's uid 2021-10-22 02:59:15 +02:00
overclockworked64 f4af27953e
Allow specifying start_method and hard_kill 2021-10-21 22:14:12 +02:00
overclockworked64 b17bdbfa7b
Add a clustering test 2021-10-21 22:14:11 +02:00
overclockworked64 5f7802dc01
Rename a variable and fix type annotations 2021-10-21 22:14:10 +02:00
overclockworked64 c8e7eb8f0b
Cancel nursery 2021-10-21 22:14:09 +02:00
overclockworked64 010a994f1d
Make sure the ID is a str 2021-10-21 22:14:08 +02:00
overclockworked64 0f613050e1
Avoid RuntimeError by not using current_actor's uid 2021-10-21 22:14:07 +02:00
overclockworked64 dc8ccca8be
Make 'async_enter_all' take a teardown trigger which '_enter_and_wait' will wait on 2021-10-21 22:14:06 +02:00
overclockworked64 21042ef926
Postpone evaluation of annotations 2021-10-21 22:14:06 +02:00
overclockworked64 4974e3efe5
Add 'open_actor_cluster' to __all__ 2021-10-21 22:14:05 +02:00
overclockworked64 f1c24c7ab7
Add 'trio.trionics' to setup.py 2021-10-21 22:14:04 +02:00
Tyler Goodlet e5b3eb117d Fix *args-like type annot 2021-10-17 08:56:35 -04:00
Tyler Goodlet 619b3b344a Lul, fix everything for cluster helper 2021-10-17 08:56:35 -04:00
Tyler Goodlet 5a99482b9d Fix type path to new `_supervise` mod 2021-10-17 08:56:35 -04:00
Tyler Goodlet 4ec177d717 Expose `Lagged` for broadcasting 2021-10-17 08:56:35 -04:00
Tyler Goodlet 9ce4dc584a Fix top level nursery import 2021-10-17 08:56:35 -04:00
Tyler Goodlet 6988e8d3c8 Add an async actor cluster spawner prototype 2021-10-17 08:56:35 -04:00
Tyler Goodlet c2a19c630b Move broadcast channel parts into trionics 2021-10-17 08:56:35 -04:00
Tyler Goodlet 917d94dcbb Start `trionics` sub-pkg with `async_enter_all()`
Since it seems we're building out more and more higher level primitives
in order to support certain parallel style actor trees and messaging
patterns (eg. task broadcast channels), we might as well start a new
sub-package for purely `trio` constructions. We hereby dub this
the realm of `trionics` (like electronics but for trios instead of
electrons).

To kick things off, add an `async_enter_all()` concurrent
exit-stack-like context manager API which will concurrently spawn
a sequence of provided async context managers and deliver their ordered
results but with proper support for `trio` cancellation semantics.
The stdlib's `AsyncExitStack` is not compatible with nurseries not
`trio` tasks (which are cancelled) since as task will be suspended on
the stack after push and does not ever hit a checkpoint until the stack
is closed.
2021-10-17 08:56:35 -04:00
Tyler Goodlet e4e47c3901 Rename the nursery module to `_supervise` 2021-10-17 08:56:35 -04:00
goodboy 828754dbb5
Merge pull request #245 from goodboy/immediate_remote_cancels
Immediate remote cancels
2021-10-17 08:16:50 -04:00
Tyler Goodlet b3c4851ffb Grab lock if cancelled during spawn before hard kill 2021-10-15 18:26:46 -04:00
Tyler Goodlet 5cfac58873 Don't pop a child entry that was never inserted 2021-10-15 18:16:58 -04:00
Tyler Goodlet 5d827f78e2 Fix pluggy readme link and typo 2021-10-15 11:42:57 -04:00
Tyler Goodlet 4f222a5f9c Use type match of expected error 2021-10-15 10:25:50 -04:00
Tyler Goodlet e4ed0fd2b3 Right, only worry about pdb lock when in debug mode 2021-10-15 09:29:25 -04:00
Tyler Goodlet a42ec1f571 Add nooz 2021-10-15 09:28:45 -04:00
Tyler Goodlet 533457c64d Handle nested multierror case on windows 2021-10-15 09:16:51 -04:00
Tyler Goodlet 51259c4809 Pass uid not actor object 2021-10-14 13:46:27 -04:00
Tyler Goodlet 7ee121aeaf Try to handle variable windows errors 2021-10-14 13:39:46 -04:00
Tyler Goodlet 9d83ef82b2 Remove union type for root getter 2021-10-14 13:39:46 -04:00
Tyler Goodlet fa317d1600 Change lock helper to take an actor uid tuple 2021-10-14 13:39:46 -04:00
Tyler Goodlet 6f5c35dd1b Fix missing task status type 2021-10-14 13:39:46 -04:00
Tyler Goodlet b14699d40b Adjust debugger tests to expect depth > 1 crashes
With the new fixes to the trio spawner we can expect that both root
*and* depth > 1 nursery owning actors will now not clobber any children
that are in debug (either via breakpoint or through crashing). The tests
changed now include more checks which ensure the 2nd level parent-ish
actors also bubble up through into `pdb` and don't kill any of their
(crashed) children before they're done themselves debugging.
2021-10-14 13:39:46 -04:00
Tyler Goodlet daa28ea0e9 Handle depth > 1 nursery owners which use debug mode 2021-10-14 13:39:46 -04:00
Tyler Goodlet 4b2710b8a5 Add tty lock acquire ctx mngr 2021-10-14 13:39:46 -04:00
Tyler Goodlet d30ce96740 Breakout `wait_for_parent_stdin_hijack()`, increase root pdb checker poll time 2021-10-14 13:39:46 -04:00
Tyler Goodlet f3a6ab62af Use debugger helper in nursery and spawn tasks 2021-10-14 13:39:46 -04:00
Tyler Goodlet 62035078ce Reduce some loglevels, stick in comment about blocking till next tick 2021-10-14 13:39:46 -04:00
Tyler Goodlet 893bad72d5 Add a maybe-open-debugger helper 2021-10-14 13:39:46 -04:00
Tyler Goodlet 77ec29008d Simplify to soft and hard reap sequences
This is actually surprisingly easy to grok having gone through a lot of
pain understanding edge cases in the zombie lord dev branch. Basically
we just need to make sure actors are managed in a 2 step reap sequence.
In the "soft" reap phase we wait for the process to terminate on its own
concurrently with (maybe) waiting for its portal's final result (if it's
a `.run_in_actor()`). If this path is cancelled or errors, then we do
a "hard" reap where we timeout and send a signal to the proc to
terminate immediately. The only last remaining trick is to tie in the
root-is-debugger-aware logic to yet again avoid tty clobbers.
2021-10-14 13:39:46 -04:00
Tyler Goodlet 2df16c1557 Lol, fix sub-actor case 2021-10-14 13:39:46 -04:00
Tyler Goodlet 46ff558556 Unwind process opening and shield hard reap 2021-10-14 13:39:46 -04:00
Tyler Goodlet bb9d9c74b1 Do immediate remote task cancels
As for `Actor.cancel()` requests, do the same for
`Actor._cancel_task()` but use `_invoke()` to ensure
correct msg transactions with caller. Don't cancel task
cancels on a cancel-all-tasks operation in attempt at
more determinism.
2021-10-14 13:39:46 -04:00
Tyler Goodlet 41f0992445 Don't whine about ; it ain't rpc 2021-10-14 13:39:46 -04:00
Tyler Goodlet 7643bbf183 Make actor runtime cancellation immediate 2021-10-14 13:39:46 -04:00
goodboy dfeebd6382
Merge pull request #243 from goodboy/less_logging
Less logging, add a `CANCEL` log level
2021-10-14 13:37:28 -04:00
Tyler Goodlet 6cda17436a Add nooz 2021-10-14 11:47:06 -04:00
Tyler Goodlet 1f0cc15675 Just set flag for use-after-closed service nursery calls 2021-10-06 17:02:13 -04:00