forked from goodboy/tractor
1
0
Fork 0
Commit Graph

716 Commits (1172cffd466e9eccfe999ca7e84f20f685fdc445)

Author SHA1 Message Date
Tyler Goodlet 3e34f0a374 Fix up var naming and typing 2021-07-02 11:58:01 -04:00
Tyler Goodlet 9e7bed646d Only send stop msg if not received from far end 2021-07-02 11:58:01 -04:00
Tyler Goodlet 0b73a4b61e Expose msg stream types at top level 2021-07-02 11:58:01 -04:00
Tyler Goodlet eb237f24cd Add dynamic pubsub test using new bidir stream apis 2021-07-02 11:58:01 -04:00
Tyler Goodlet 83f1e79fdd Use context for remote debugger locking
A context is the natural fit (vs. a receive stream) for locking the root
proc's tty usage via it's `.started()` sync point. Simplify the
`_breakpoin()` routine to be a simple async func instead of all this
"returning a coroutine" stuff from before we decided that
`tractor.breakpoint()` must be async. Use `runtime` level for locking
logging making it easier to trace.
2021-07-02 11:58:01 -04:00
Tyler Goodlet 1192541623 Be more pedantic with error handling 2021-07-02 11:58:01 -04:00
Tyler Goodlet 15b63b7190 Fix typing 2021-07-02 11:58:01 -04:00
Tyler Goodlet c4d5f9d41e Parametrize with async for style tests 2021-07-02 11:58:01 -04:00
Tyler Goodlet b7089bb4e0 Support passing `shield` at stream contruction 2021-07-02 11:58:01 -04:00
Tyler Goodlet ecb9655519 Add basic test set 2021-07-02 11:58:01 -04:00
Tyler Goodlet f98860a5e5 Cancel scope on stream consumer completion 2021-07-02 11:58:01 -04:00
Tyler Goodlet 8c8a236799 Expose `@context` decorator at top level 2021-07-02 11:58:01 -04:00
Tyler Goodlet 38ccbd0a9c Add initial bi-directional streaming
This mostly adds the api described in
https://github.com/goodboy/tractor/issues/53#issuecomment-806258798

The first draft summary:
- formalize bidir steaming using the `trio.Channel` style interface
  which we derive as a `MsgStream` type.
- add `Portal.open_context()` which provides a `trio.Nursery.start()`
  remote task invocation style for setting up and tearing down tasks
  contexts in remote actors.
- add a distinct `'started'` message to the ipc protocol to facilitate
  `Context.start()` with a first return value.
- for our `ReceiveMsgStream` type, don't cancel the remote task in
  `.aclose()`; this is now done explicitly by the surrounding `Context`
   usage: `Context.cancel()`.
- streams in either direction still use a `'yield'` message keeping the
  proto mostly symmetric without having to worry about which side is the
  caller / portal opener.
- subtlety: only allow sending a `'stop'` message during a 2-way
  streaming context from `ReceiveStream.aclose()`, detailed comment
  with explanation is included.

Relates to #53
2021-07-02 11:58:01 -04:00
Tyler Goodlet 85246d2df3 Benign deps reorg 2021-07-02 11:56:14 -04:00
Tyler Goodlet b372f4c92b Handle top level multierror that presents now? 2021-07-02 11:55:16 -04:00
Tyler Goodlet 32b4ae0603 Accept transport closed error during handshake and msg loop 2021-07-02 11:38:24 -04:00
Tyler Goodlet 80e100f818 Add our own "transport closed" signal
This change some super old (and bad) code from the project's very early
days. For some redic reason i must have thought masking `trio`'s
internal stream / transport errors and a TCP EOF as `StopAsyncIteration`
somehow a good idea. The reality is you probably
want to know the difference between an unexpected transport error
and a simple EOF lol. This begins to resolve that by adding our own
special `TransportClosed` error to signal the "graceful" termination of
a channel's underlying transport. Oh, and this builds on the `msgspec`
integration which helped shed light on the core issues here B)
2021-07-02 11:36:22 -04:00
Tyler Goodlet 44d7988204 New docs theme hotfix 2021-06-14 08:10:59 -04:00
goodboy e98302212a
Merge pull request #211 from goodboy/new_docs_polish
New docs theme, readme actors rant.
2021-06-14 07:33:02 -04:00
Tyler Goodlet 0301d105dd Better rant flow as per suggestions 2021-06-14 06:41:10 -04:00
Tyler Goodlet 4ee7db338d Fill out the rant a bit more 2021-06-14 06:31:16 -04:00
Tyler Goodlet 558d546c8f Bump readme for #210 2021-06-14 06:31:16 -04:00
Tyler Goodlet 5528a4eb45 Attempt configuring sphinx-book-theme 2021-06-14 06:31:16 -04:00
Tyler Goodlet fb23a9d8d4 Try out sphinx-book-theme 2021-06-14 06:31:16 -04:00
goodboy f48548ab94
Merge pull request #197 from goodboy/drop_run
Drop run
2021-05-07 12:02:23 -04:00
Tyler Goodlet 73e123bac7 Fix line length 2021-05-07 11:21:40 -04:00
Tyler Goodlet 2b4cf59ee1 Drop sleep 2021-05-07 11:21:40 -04:00
Tyler Goodlet 0551756e22 Use trio.run() in windows tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 5ca963148e Disable leftover debug mode 2021-05-07 11:21:40 -04:00
Tyler Goodlet 4798d3b5db Drop lingering rpc_module_paths refs 2021-05-07 11:21:40 -04:00
Tyler Goodlet 247483ee93 Drop run and rpc_module_paths from streaming tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 9e64161538 Drop run and rpc_module_paths from rpc tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 3bddf9a94b Drop run and rpc_module_paths from spawning tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 1eedd463cb Drop run and rpc_module_paths from pubsub tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet b46e60ab9d Drop run from multi prog tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet cb527c2562 Mostly drop run from local tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 1584c547cd Drop run and rpc_module_paths from discovery tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet 2efd8ed167 Drop run and rpc_module_paths from cancel tests 2021-05-07 11:21:40 -04:00
Tyler Goodlet a54260a67e Drop tractor.run() from docs 2021-05-07 11:21:40 -04:00
Tyler Goodlet 98a0594c26 Drop `tractor.run()` from all examples 2021-05-07 11:21:40 -04:00
goodboy ffd10e193e
Merge pull request #208 from goodboy/mp_teardown_hardening
Mp teardown hardening
2021-05-06 19:59:50 -04:00
Tyler Goodlet 87971de1d9 Re-raise any sidestepped `trio.Cancelled` 2021-05-06 12:05:17 -04:00
Tyler Goodlet 9f38406e85 Appease mypy 2021-05-06 12:05:17 -04:00
Tyler Goodlet c4b42000eb Shield around root actor cancel 2021-05-06 12:05:17 -04:00
Tyler Goodlet 607c48f1ac Distinctly separate and harden mp spawning
It's clear now that special attention is needed to handle the case where
a spawned `multiprocessing` proc is started but then the parent is
cancelled before the child can connect back; in this case we need to be
sure to kill the near-zombie child asap. This may end up being the
solution to other resiliency issues seen around mp with nested process
trees too. More testing is needed to be sure.

Relates to #84 #89 #134 #146
2021-05-06 12:05:17 -04:00
goodboy af93b8532a
Merge pull request #206 from goodboy/stream_contexts
Explicit stream contexts
2021-05-04 10:41:03 -04:00
Tyler Goodlet fc36e73628 Comment out `MsgStream` for now 2021-04-28 16:40:38 -04:00
Tyler Goodlet b1f657e246 De-compact async with tuple on 3.8-
Turns out can't use the nicer syntax before python 3.9 (even though it
doesn't seem documented anywhere?).

Relates to #207
2021-04-28 16:35:15 -04:00
Tyler Goodlet 2498a4963b Update all tests to new streaming API 2021-04-28 12:23:14 -04:00
Tyler Goodlet 5a5e6baad1 Update all examples to new streaming API 2021-04-28 12:23:08 -04:00