Commit Graph

377 Commits (stin_char_relay)

Author SHA1 Message Date
Tyler Goodlet eebd9bf05c Flip to trace logging 2020-07-27 09:03:41 -04:00
Tyler Goodlet 7886a9fa64 Try ipdb to get tab-complete without a tty
It doesn't work but in theory since ipython uses python-prompt-toolkit
this may be possible (and is really the best solution over trying to
hack ttys/ptys in the child). If `ipdb` is installed try using it.
2020-07-27 09:03:41 -04:00
Tyler Goodlet 042f2326db Play around with relaying each char to child 2020-07-27 09:03:41 -04:00
Tyler Goodlet 7b5af3b2d4 Pass a copy of the expected exposed modules 2020-07-27 00:06:06 -04:00
Tyler Goodlet bcbef1a095 WIP debugging test script 2020-07-27 00:06:06 -04:00
Tyler Goodlet b1897da328 Add support for "debug mode"
When enabled a crashed actor will connect to the parent with `pdb`
in post mortem mode.
2020-07-27 00:06:06 -04:00
Tyler Goodlet 23fee8820b Initial attempt at multi-actor debugging
Allow entering and attaching to a `pdb` instance in a child process.
The current hackery is to have the child make an rpc to the parent and
ask it to hijack stdin, once complete the child enters a `pdb` blocking
method. The parent then relays all stdin input to the child thus
controlling the "remote" debugger.

A few things were added to accomplish this:
- tracking the mapping of subactors to their parent nurseries
- in the root actor, cancelling all nurseries under the root `trio` task
  on cancellation (i.e. `Actor.cancel()`)
- pass a "runtime vars" map down the actor tree for propagating global state
2020-07-27 00:06:06 -04:00
Tyler Goodlet 96cf4b6e9f Allow opening a portal through an existing channel 2020-07-27 00:06:06 -04:00
Tyler Goodlet 90499c19d7 Create runtime variables 2020-07-27 00:06:06 -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
Tyler Goodlet cfc97c4204 Set correct master doc name 2020-02-10 12:26:19 -05:00
Tyler Goodlet 3dcdc9181e Include our `__main__.py` script ex for windows 2020-02-10 12:22:14 -05:00
Tyler Goodlet 20f9ccfa9e Move two more examples out of docs for testing 2020-02-10 12:14:16 -05:00
Tyler Goodlet 63bcd99323 Only error the exs test when "Error" in last line of output 2020-02-10 12:14:16 -05:00
Tyler Goodlet 5a19826bd3 Drop sphinx toctree from readme 2020-02-10 12:14:16 -05:00
Tyler Goodlet 802f47b4ca Drop uneeded import 2020-02-10 12:14:16 -05:00
Tyler Goodlet 03d07cb12a Mirror readme off docs intro 2020-02-10 12:14:16 -05:00
Tyler Goodlet cd06298476 Simplify and re-org the intro section 2020-02-10 12:14:16 -05:00
Tyler Goodlet d6abfa774a Drop toc from sidebar 2020-02-10 12:14:16 -05:00
Tyler Goodlet 66b803780f Replace examples with ..literalinclude directives
This should address both #98 and #108 by using our now tested examples
scripts directly in the documentation (so we know they must work or CI
will fail).

Resolves #98 #108
2020-02-10 12:14:16 -05:00
Tyler Goodlet 5d2fd0eb05 Remove duplicate docs from readme 2020-02-10 12:14:16 -05:00
Tyler Goodlet 6e7d57c01d Add initial sphinx docs draft 2020-02-10 12:14:16 -05:00
goodboy 3b3d563ac9
Merge pull request #102 from goodboy/example_tests
Test docs examples as scripts
2020-02-10 11:13:32 -06: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 30f8dd8be4 Pass a `Channel` to `LocalPortal` for compat purposes 2020-02-09 01:59:39 -05:00
Tyler Goodlet 9fb05d8849 Drop uneeded import 2020-02-09 01:07:14 -05:00
Tyler Goodlet 596aca8097 Alias __mp_main__ at import time 2020-02-09 01:07:14 -05:00