WIP tinkering with strict-eg-tns and cluster API
Seems that the way the actor-nursery interacts with the `.trionics.gather_contexts()` API on cancellation makes our `.trionics.collapse_eg()` not work as intended? I need to dig into how `ActorNursery.cancel()` and `.__aexit__()` might be causing this discrepancy.. Consider this a commit-of-my-index type save for rn.cluster_api_egs_conflict
parent
4a9e8731f1
commit
02618bb22f
|
@ -25,14 +25,17 @@ def test_empty_mngrs_input_raises() -> None:
|
|||
) as portals,
|
||||
|
||||
gather_contexts(
|
||||
# NOTE: it's the use of inline-generator syntax
|
||||
# here that causes the empty input.
|
||||
mngrs=(
|
||||
p.open_context(worker) for p in portals.values()
|
||||
),
|
||||
# ^^NOTE XXX ^^^
|
||||
# it's the use of inline-generator syntax here
|
||||
# that causes the "empty input" -> ValueError,
|
||||
# see `._clustering` impl.
|
||||
),
|
||||
):
|
||||
assert 0
|
||||
# test should fail if we mk it here!
|
||||
assert 0, 'Should have raised val-err !?'
|
||||
|
||||
with pytest.raises(ValueError):
|
||||
trio.run(main)
|
||||
|
|
|
@ -55,10 +55,17 @@ async def open_actor_cluster(
|
|||
raise ValueError(
|
||||
'Number of names is {len(names)} but count it {count}')
|
||||
|
||||
async with tractor.open_nursery(
|
||||
async with (
|
||||
# tractor.trionics.collapse_eg(),
|
||||
tractor.open_nursery(
|
||||
**runtime_kwargs,
|
||||
) as an:
|
||||
async with trio.open_nursery() as n:
|
||||
) as an
|
||||
):
|
||||
async with (
|
||||
tractor.trionics.collapse_eg(),
|
||||
trio.open_nursery() as tn,
|
||||
tractor.trionics.maybe_raise_from_masking_exc()
|
||||
):
|
||||
uid = tractor.current_actor().uid
|
||||
|
||||
async def _start(name: str) -> None:
|
||||
|
@ -69,9 +76,8 @@ async def open_actor_cluster(
|
|||
)
|
||||
|
||||
for name in names:
|
||||
n.start_soon(_start, name)
|
||||
tn.start_soon(_start, name)
|
||||
|
||||
assert len(portals) == count
|
||||
yield portals
|
||||
|
||||
await an.cancel(hard_kill=hard_kill)
|
||||
|
|
Loading…
Reference in New Issue