Commit Graph

795 Commits (2745a2b1dca96f97b41420a2ce83f8183dc00d65)

Author SHA1 Message Date
Guillermo Rodriguez 8da45eedf4
Merge pull request #143 from goodboy/ensure_deregister
Ensure actors de-register with arbiter when cancelled during infitinite streaming.
2020-08-04 12:19:02 -03:00
Tyler Goodlet 09ae51900d Better clarify uid comment 2020-08-04 09:52:49 -04:00
Tyler Goodlet 4f92cfe74f Don't `.aclose` `trio` processes until the very end
Trio will kill subprocesses via `Process.__aexit__()` using a `finally:`
block (which, yes, will get triggered on cancellation) so we avoid that
until true process "tear down" since subactors do many things during
graceful shutdown (such as de-registering from the name discovery
system). Oddly this only seems to be an issue during cancellation of
infinite stream consumption.

Resolves #141
2020-08-03 18:57:00 -04:00
Tyler Goodlet ae9016c06a Log on KBI cancelled termination 2020-08-03 18:46:18 -04:00
Tyler Goodlet a24c6bfdd2 Correctly catch cancelled nursery case (purely for logging) 2020-08-03 18:44:50 -04:00
Tyler Goodlet 56b81f07e5 Return `Dict[Tuple, Tuple]` from `.get_registry()` 2020-08-03 18:42:23 -04:00
Tyler Goodlet fbd68d2d91 Allow for tuple keys with std `msgpack` 2020-08-03 18:41:21 -04:00
Tyler Goodlet a5279f80a7 Actually reproduce the de-registration problem
This truly reproduces #141. It turns out the problem only occurs when
we're cancelled in the middle of consuming "infinite streams".
Good news is this tests a lot of edge cases :)
2020-08-03 18:28:09 -04:00
Tyler Goodlet 699bfd1857 Run unreg on cancel tests with remote arbiter as well 2020-08-03 15:41:41 -04:00
Tyler Goodlet 639299e6eb Expose a `.get_registry()` method on the arbiter 2020-08-03 15:40:41 -04:00
Tyler Goodlet 2ccaa94c60 Move daemon fixture up to conftest 2020-08-03 15:39:54 -04:00
Tyler Goodlet 0d9483376d Test cancel with SIGINT on non-windows as well 2020-08-03 13:01:56 -04:00
Tyler Goodlet cd2d8c217a Test that subactors deregister on cancel 2020-08-03 12:53:03 -04:00
goodboy a399bd3033
Merge pull request #133 from guilledk/drop_cloudpickle
Drop cloudpickle dependency
2020-07-29 18:24:27 -04:00
Guillermo Rodriguez 3e29fcf1ea
Docstring to the top\!, and redundant spaces goodbye\! 2020-07-29 15:39:38 -03:00
Guillermo Rodriguez a565d38251
Merge pull request #2 from goodboy/start_up_sequence_trickery
Start up sequence trickery
2020-07-29 15:02:51 -03:00
Tyler Goodlet da56d0f043 Add slight delays to SIGINT tests on mp 2020-07-29 13:27:15 -04:00
Tyler Goodlet 8f17c89cf9 Skip **every** quad test for mp on ci 2020-07-29 10:26:19 -04:00
Tyler Goodlet 9a40291d4a Repair startup sequence around parent state transfer
In order to have reliable subactor startup we need the following
sequence to take place:
- connect to the parent actor, handshake and receive runtime state
- load exposed modules into memory
- start the channel server up fully using the provided bind address
- finally, start processing new messages from the parent

Add a bunch more comments to clarify all this.
2020-07-28 22:25:22 -04:00
Guillermo Rodriguez 0a5691e0a8
Removed arbiter_addr local, and bind_addr is now passed through channel, in early child actor init. 2020-07-28 11:55:11 -03:00
Guillermo Rodriguez 8b44ec7a5d
Actually dropping the cloudpickle dependency from setup.py 2020-07-27 21:10:04 -03:00
Guillermo Rodriguez ef053eb070
Added named arguments to child init, and now passing less of them. 2020-07-27 21:05:00 -03:00
Guillermo Rodriguez e5dbf14ec3
Onlt await params in trio mode 2020-07-27 15:20:55 -03:00
Guillermo Rodriguez 2a407be532
Now passing additional initialization parameters through channel early after handshake. 2020-07-27 14:55:37 -03:00
goodboy 2cc4d7ce04
Merge pull request #135 from goodboy/fix_win_ci_again
Fix windows CI, again.
2020-07-27 13:19:01 -04:00
Tyler Goodlet 5715fd4599 Skip streaming tests 2020-07-27 12:20:46 -04:00
Tyler Goodlet e8a38e4d15 Fix cancelled type handling 2020-07-27 11:15:05 -04:00
goodboy ed96672136
Merge pull request #128 from goodboy/flaky_tests
Drop trio-run-in-process,  use pure trio process spawner, test out of channel ctrl-c subactor cancellation
2020-07-26 23:59:58 -04:00
Tyler Goodlet 3c7ec72f8e Fix SIGINT test names 2020-07-26 23:37:44 -04:00
Tyler Goodlet 5a27065a10 Finally tame the super flaky tests
- ease up on first stream test run deadline
- skip streaming tests in CI for mp backend, period
- give up on > 1 depth nested spawning with mp
- completely give up on slow spawning on windows
2020-07-26 22:53:40 -04:00
Tyler Goodlet 891edbab5f Run the trio spawner in nested tests 2020-07-25 18:19:17 -04:00
Tyler Goodlet dddbeb0e71 Run Windows on trio and mp backends
The new pure trio spawning backend uses `subprocess` internally which is
also supported on windows so let's run it in CI.
2020-07-25 13:41:48 -04:00
Tyler Goodlet 7c3928f0bf Oh mypy.. 2020-07-24 17:31:24 -04:00
Tyler Goodlet d3acb8d061 Wait on proc before killing stdio 2020-07-24 17:08:52 -04:00
Tyler Goodlet efde3a5773 Simplify the `_child.py` script
We don't really need stdin for anything but passing the entry point and
detaching it seemed to just cause errors on cancellation teardown.
2020-07-24 17:08:52 -04:00
Tyler Goodlet aa620fe61d Use `trio.Process.__aexit__()` and pass the actor uid
Using the context manager interface does some extra teardown beyond simply
calling `.wait()`. Pass the subactor's "uid" on the exec line for
debugging purposes when monitoring the process tree from the OS.
Hard code the child script module path to avoid a double import warning.
2020-07-24 17:08:52 -04:00
Tyler Goodlet a215df8dfc Add true ctrl-c tests using an out-of-band SIGINT
Verify ctrl-c, as a user would trigger it, properly cancels the actor
tree. This was an issue with `trio-run-in-process` that clearly wasn't
being handled correctly but for sure is now with the plain old
`trio` process spawner.

Resolves #115
2020-07-24 17:08:52 -04:00
Tyler Goodlet 4de75c3a9d Test cancel via api and keyboard interrupt
An initial attempt to discover an issue with trio-run-inprocess.
This is a good test to have regardless.
2020-07-24 17:08:52 -04:00
Tyler Goodlet 5adf2f3b0c Add logging to some cancel tests 2020-07-24 17:08:52 -04:00
Tyler Goodlet 4516febe26 Make sure to wait trio processes on teardown 2020-07-24 17:08:52 -04:00
Tyler Goodlet 0b305fd78a Change spawn method name in `Actor.load_modules()` 2020-07-24 17:08:52 -04:00
Tyler Goodlet 0936bdc592 Add back subactor logging 2020-07-24 17:08:52 -04:00
Guillermo Rodriguez 56463a08df First attempt at removing trip & updating hazmat -> lowlevel 2020-07-24 17:08:52 -04:00
Tyler Goodlet 7c73775474 Force keyword only args in actor spawn methods 2020-07-24 17:06:43 -04:00
Tyler Goodlet 8fbdfd6a3a Add an obnoxious error message on internal failures 2020-07-24 17:06:23 -04:00
Tyler Goodlet 1706791313 Drop entrypoints from `Actor` 2020-07-24 17:04:22 -04:00
Tyler Goodlet 8e32199509 Get entry points reorg without asyncio compat
This is an edit to factor out changes needed for the `asyncio` in guest mode
integration (which currently isn't tested well) so that later more pertinent
changes (which are tested well) can be rebased off of this branch and
merged into mainline sooner. The *infect_asyncio* branch will need to be
rebased onto this branch as well before merge to mainline.
2020-07-24 17:02:03 -04:00
Tyler Goodlet 8054bc7c70 Support "infected asyncio" actors
This is an initial solution for #120.

Allow spawning `asyncio` based actors which run `trio` in guest
mode. This enables spawning `tractor` actors on top of the `asyncio`
event loop whilst still leveraging the SC focused internal actor
supervision machinery. Add a `tractor.to_syncio.run()` api to allow
spawning tasks on the `asyncio` loop from an embedded (remote) `trio`
task and return or stream results all the way back through the `tractor`
IPC system using a very similar api to portals.

One outstanding problem is getting SC around calls to
`asyncio.create_task()`. Currently a task that crashes isn't able to
easily relay the error to the embedded `trio` task without us fully
enforcing the portals based message protocol (which seems superfluous
given the error ref is in process). Further experiments using `anyio`
task groups may alleviate this.
2020-07-24 16:48:06 -04:00
goodboy 2b2cf2e001
Merge pull request #110 from goodboy/init_sphinx_docs
Initial sphinx docs
2020-02-10 18:07:37 -06:00
Tyler Goodlet d62610c44e Search for guard and strip instead of hardcoding 2020-02-10 12:59:44 -05:00