Passthrough runtime kwargs from `open_actor_cluster()`

harden_cluster_tests
Tyler Goodlet 2022-12-11 19:47:59 -05:00
parent d8e48e29ba
commit c606be8c64
1 changed files with 8 additions and 3 deletions

View File

@ -32,9 +32,12 @@ import tractor
async def open_actor_cluster( async def open_actor_cluster(
modules: list[str], modules: list[str],
count: int = cpu_count(), count: int = cpu_count(),
names: Optional[list[str]] = None, names: list[str] | None = None,
start_method: Optional[str] = None,
hard_kill: bool = False, hard_kill: bool = False,
# passed through verbatim to ``open_root_actor()``
**runtime_kwargs,
) -> AsyncGenerator[ ) -> AsyncGenerator[
dict[str, tractor.Portal], dict[str, tractor.Portal],
None, None,
@ -49,7 +52,9 @@ async def open_actor_cluster(
raise ValueError( raise ValueError(
'Number of names is {len(names)} but count it {count}') 'Number of names is {len(names)} but count it {count}')
async with tractor.open_nursery(start_method=start_method) as an: async with tractor.open_nursery(
**runtime_kwargs,
) as an:
async with trio.open_nursery() as n: async with trio.open_nursery() as n:
uid = tractor.current_actor().uid uid = tractor.current_actor().uid