From aa36abf36e5e13228a90304a03a30379e3e74651 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Thu, 9 Mar 2023 14:09:12 -0500 Subject: [PATCH] Support passing `tractor` "actor runtime vars" down the runtime --- piker/service/_actor_runtime.py | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/piker/service/_actor_runtime.py b/piker/service/_actor_runtime.py index 134b085c..3e35864d 100644 --- a/piker/service/_actor_runtime.py +++ b/piker/service/_actor_runtime.py @@ -74,6 +74,7 @@ async def open_piker_runtime( # and spawn the service tree distributed per that. start_method: str = 'trio', + tractor_runtime_overrides: dict | None = None, **tractor_kwargs, ) -> tuple[ @@ -93,6 +94,8 @@ async def open_piker_runtime( actor = tractor.current_actor().uid except tractor._exceptions.NoRuntime: + tractor._state._runtime_vars[ + 'piker_vars'] = tractor_runtime_overrides registry_addr = registry_addr or _default_reg_addr @@ -152,6 +155,8 @@ async def open_pikerd( tsdb: bool = False, es: bool = False, + **kwargs, + ) -> Services: ''' Start a root piker daemon with an indefinite lifetime. @@ -173,6 +178,8 @@ async def open_pikerd( debug_mode=debug_mode, registry_addr=registry_addr, + **kwargs, + ) as (root_actor, reg_addr), tractor.open_nursery() as actor_nursery, trio.open_nursery() as service_nursery, @@ -297,6 +304,7 @@ async def maybe_open_pikerd( loglevel=loglevel, **kwargs, ) as _, + tractor.find_actor( _root_dname, arbiter_sockaddr=registry_addr, @@ -319,6 +327,8 @@ async def maybe_open_pikerd( tsdb=tsdb, es=es, + **kwargs, + ) as service_manager: # in the case where we're starting up the # tractor-piker runtime stack in **this** process