Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Sigintsaviour ci worked #315

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
0503142
Add WIP while-debugger-active SIGINT ignore handler
goodboy Jan 23, 2022
1e789ec
(facepalm) Reraise `BdbQuit` and discard ownerless lock releases
goodboy Jan 23, 2022
688e0b9
Refine the handler for child vs. root cases
goodboy Jan 23, 2022
aee00e6
Make `mypy` happy
goodboy Jan 23, 2022
aad9d7e
Add a pre-started breakpoint example
goodboy Jan 27, 2022
a8a2110
Handle a context cancel? Might be a noop
goodboy Feb 4, 2022
4ea2bc5
Fix example name typo
goodboy Feb 7, 2022
a617631
Try overriding `_GeneratorContextManager.__exit__()`; didn't work..
goodboy Feb 7, 2022
9e0bb4f
Drop all the `@cm.__exit__()` override attempts..
goodboy Feb 7, 2022
a0016bc
A `.open_context()` example that causes a hang!
goodboy Feb 7, 2022
4e6d009
Add and use a pdb instance factory
goodboy Feb 9, 2022
95ccb27
Add notes around py3.10 stdlib bug from `pdb++`
goodboy Feb 9, 2022
5dd8adc
Typing fixes, simplify `_set_trace()`
goodboy Feb 9, 2022
7481982
Drop high log level in ctx example
goodboy Feb 9, 2022
d280c26
Only cancel/get-result from a ctx if transport is up
goodboy Feb 14, 2022
a5f543e
Make `Actor._process_messages()` report disconnects
goodboy Feb 14, 2022
4e06b10
Drop uneeded backframe traceback hide annotation
goodboy Feb 14, 2022
e2169f2
Type annot updates
goodboy Feb 14, 2022
1163ec5
Avoid attr error XD
goodboy Feb 16, 2022
df16a0c
Pre-declare disconnected flag
goodboy Feb 16, 2022
67607a4
Add back in async gen loop
goodboy Feb 16, 2022
ebefd6e
Add example that triggers bug #302
goodboy Feb 17, 2022
7ecc48b
Make example a subpkg for `python -m <mod>` testing
goodboy Feb 18, 2022
1fd4588
Only warn on `trio.BrokenResourceError`s from `_invoke()`
goodboy Feb 18, 2022
2800100
Just warn on IPC breaks
goodboy Feb 24, 2022
d1f347c
Log cancels with appropriate level
goodboy Mar 4, 2022
11c1582
Always call pdb hook even if tty locking fails
goodboy Apr 11, 2022
931b20c
Always propagate SIGINT when no locking peer found
goodboy May 14, 2022
7b40491
Tolerate double `.remove()`s of stream on portal teardowns
goodboy May 14, 2022
dade6a4
Readme formatting tweaks
goodboy May 31, 2022
70d1c98
Always undo SIGINT overrides , cancel detached children
goodboy Jun 26, 2022
70e4458
Add runtime level msg around channel draining
goodboy Jun 26, 2022
8a70a52
Add spaces before values in log msg
goodboy Jun 26, 2022
ee8ead4
Move pydantic-click hang example to new dir, skip in test suite
goodboy Jun 26, 2022
7dd72e0
Show full KBI trace for help with CI hangs
goodboy Jun 26, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,4 +111,4 @@ jobs:
run: pip install -U . -r requirements-test.txt -r requirements-docs.txt --upgrade-strategy eager

- name: Run tests
run: pytest tests/ --spawn-backend=${{ matrix.spawn_backend }} -rs
run: pytest tests/ --spawn-backend=${{ matrix.spawn_backend }} -rs --full-trace
11 changes: 6 additions & 5 deletions docs/README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,14 @@
|gh_actions|
|docs|

``tractor`` is a `structured concurrent`_, multi-processing_ runtime built on trio_.
``tractor`` is a `structured concurrent`_, multi-processing_ runtime
built on trio_.

Fundamentally ``tractor`` gives you parallelism via ``trio``-"*actors*":
our nurseries_ let you spawn new Python processes which each run a ``trio``
scheduled runtime - a call to ``trio.run()``.

We believe the system adhere's to the `3 axioms`_ of an "`actor model`_"
We believe the system adheres to the `3 axioms`_ of an "`actor model`_"
but likely *does not* look like what *you* probably think an "actor
model" looks like, and that's *intentional*.

Expand Down Expand Up @@ -577,13 +578,13 @@ say hi, please feel free to reach us in our `matrix channel`_. If
matrix seems too hip, we're also mostly all in the the `trio gitter
channel`_!

.. _structured concurrent: https://trio.discourse.group/t/concise-definition-of-structured-concurrency/228
.. _multi-processing: https://en.wikipedia.org/wiki/Multiprocessing
.. _trio: https://github.com/python-trio/trio
.. _nurseries: https://vorpus.org/blog/notes-on-structured-concurrency-or-go-statement-considered-harmful/#nurseries-a-structured-replacement-for-go-statements
.. _actor model: https://en.wikipedia.org/wiki/Actor_model
.. _trio: https://github.com/python-trio/trio
.. _multi-processing: https://en.wikipedia.org/wiki/Multiprocessing
.. _trionic: https://trio.readthedocs.io/en/latest/design.html#high-level-design-principles
.. _async sandwich: https://trio.readthedocs.io/en/latest/tutorial.html#async-sandwich
.. _structured concurrent: https://trio.discourse.group/t/concise-definition-of-structured-concurrency/228
.. _3 axioms: https://www.youtube.com/watch?v=7erJ1DV_Tlo&t=162s
.. .. _3 axioms: https://en.wikipedia.org/wiki/Actor_model#Fundamental_concepts
.. _adherance to: https://www.youtube.com/watch?v=7erJ1DV_Tlo&t=1821s
Expand Down
Empty file added examples/__init__.py
Empty file.
50 changes: 50 additions & 0 deletions examples/debugging/subactor_bp_in_ctx.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import tractor
import trio


async def gen():
yield 'yo'
await tractor.breakpoint()
yield 'yo'
await tractor.breakpoint()


@tractor.context
async def just_bp(
ctx: tractor.Context,
) -> None:

await ctx.started()
await tractor.breakpoint()

# TODO: bps and errors in this call..
async for val in gen():
print(val)

# await trio.sleep(0.5)

# prematurely destroy the connection
await ctx.chan.aclose()

# THIS CAUSES AN UNRECOVERABLE HANG
# without latest ``pdbpp``:
assert 0



async def main():
async with tractor.open_nursery(
debug_mode=True,
) as n:
p = await n.start_actor(
'bp_boi',
enable_modules=[__name__],
)
async with p.open_context(
just_bp,
) as (ctx, first):
await trio.sleep_forever()


if __name__ == '__main__':
trio.run(main)
49 changes: 49 additions & 0 deletions examples/integration/open_context_and_sleep.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
import trio
import click
import tractor
import pydantic
# from multiprocessing import shared_memory


@tractor.context
async def just_sleep(

ctx: tractor.Context,
**kwargs,

) -> None:
'''
Test a small ping-pong 2-way streaming server.

'''
await ctx.started()
await trio.sleep_forever()


async def main() -> None:

proc = await trio.open_process( (
'python',
'-c',
'import trio; trio.run(trio.sleep_forever)',
))
await proc.wait()
# await trio.sleep_forever()
# async with tractor.open_nursery() as n:

# portal = await n.start_actor(
# 'rpc_server',
# enable_modules=[__name__],
# )

# async with portal.open_context(
# just_sleep, # taken from pytest parameterization
# ) as (ctx, sent):
# await trio.sleep_forever()



if __name__ == '__main__':
import time
# time.sleep(999)
trio.run(main)
7 changes: 5 additions & 2 deletions tests/test_docs_examples.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,11 +81,14 @@ def run(script_code):
'example_script',

# walk yields: (dirpath, dirnames, filenames)
[(p[0], f) for p in os.walk(examples_dir()) for f in p[2]
[
(p[0], f) for p in os.walk(examples_dir()) for f in p[2]

if '__' not in f
and f[0] != '_'
and 'debugging' not in p[0]],
and 'debugging' not in p[0]
and 'integration' not in p[0]
],

ids=lambda t: t[1],
)
Expand Down
Loading