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
Changes from 1 commit
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
Prev Previous commit
Next Next commit
Type annot updates
goodboy committed Jul 27, 2022

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
commit e2169f227d9fc7f5190d2fc1347bbb46ece873de
26 changes: 16 additions & 10 deletions tractor/_actor.py
Original file line number Diff line number Diff line change
@@ -26,8 +26,11 @@
import importlib.util
import inspect
import uuid
import typing
from typing import Any, Optional, Union
from typing import (
Any, Optional,
Union, TYPE_CHECKING,
Callable,
)
from types import ModuleType
import sys
import os
@@ -57,6 +60,10 @@
from . import _mp_fixup_main


if TYPE_CHECKING:
from ._supervise import ActorNursery


log = get_logger('tractor')


@@ -65,7 +72,7 @@ async def _invoke(
actor: 'Actor',
cid: str,
chan: Channel,
func: typing.Callable,
func: Callable,
kwargs: dict[str, Any],

is_rpc: bool = True,
@@ -426,7 +433,7 @@ def __init__(
# (chan, cid) -> (cancel_scope, func)
self._rpc_tasks: dict[
tuple[Channel, str],
tuple[trio.CancelScope, typing.Callable, trio.Event]
tuple[trio.CancelScope, Callable, trio.Event]
] = {}

# map {actor uids -> Context}
@@ -515,6 +522,7 @@ async def _stream_handler(
self._no_more_peers = trio.Event() # unset

chan = Channel.from_stream(stream)
uid: Optional[tuple[str, str]] = chan.uid
log.runtime(f"New connection to us {chan}")

# send/receive initial handshake response
@@ -562,7 +570,7 @@ async def _stream_handler(
# append new channel
self._peers[uid].append(chan)

local_nursery: Optional['ActorNursery'] = None # noqa
local_nursery: Optional[ActorNursery] = None # noqa

# Begin channel management - respond to remote requests and
# process received reponses.
@@ -591,10 +599,9 @@ async def _stream_handler(
entry = local_nursery._children.get(uid)
if entry:
_, proc, _ = entry
if proc.poll() is not None:
log.error('Actor {uid} proc died and IPC broke?')
else:
log.error(f'Actor {uid} IPC connection broke!?')
log.error(f'Actor {uid}@{proc} IPC connection broke!?')
# if proc.poll() is not None:
# log.error('Actor {uid} proc died and IPC broke?')

log.cancel(f"Waiting on cancel request to peer {chan.uid}")
# XXX: this is a soft wait on the channel (and its
@@ -635,7 +642,6 @@ async def _stream_handler(
log.runtime(f"Releasing channel {chan} from {chan.uid}")
chans = self._peers.get(chan.uid)
chans.remove(chan)
uid = chan.uid

if not chans:
log.runtime(f"No more channels for {chan.uid}")
5 changes: 3 additions & 2 deletions tractor/_portal.py
Original file line number Diff line number Diff line change
@@ -24,7 +24,8 @@
import inspect
from typing import (
Any, Optional,
Callable, AsyncGenerator
Callable, AsyncGenerator,
Type,
)
from functools import partial
from dataclasses import dataclass
@@ -444,7 +445,7 @@ async def open_context(

uid = self.channel.uid
cid = ctx.cid
etype: Optional[Exception] = None
etype: Optional[Type[BaseException]] = None

# deliver context instance and .started() msg value in open tuple.
try: