Expose `drop_root_perms_for_ahab` from `pikerd` factories to `ahabd`

service_subpkg
Tyler Goodlet 2023-03-09 18:34:21 -05:00
parent 0772b4a0fa
commit 44a3115539
1 changed files with 32 additions and 20 deletions

View File

@ -154,6 +154,7 @@ async def open_pikerd(
# db init flags # db init flags
tsdb: bool = False, tsdb: bool = False,
es: bool = False, es: bool = False,
drop_root_perms_for_ahab: bool = True,
**kwargs, **kwargs,
@ -203,6 +204,7 @@ async def open_pikerd(
'marketstored', 'marketstored',
start_marketstore, start_marketstore,
loglevel=loglevel, loglevel=loglevel,
drop_root_perms=drop_root_perms_for_ahab,
) )
) )
@ -224,6 +226,7 @@ async def open_pikerd(
'elasticsearch', 'elasticsearch',
start_elasticsearch, start_elasticsearch,
loglevel=loglevel, loglevel=loglevel,
drop_root_perms=drop_root_perms_for_ahab,
) )
) )
@ -244,28 +247,29 @@ async def open_pikerd(
service_nursery.cancel_scope.cancel() service_nursery.cancel_scope.cancel()
@acm # TODO: do we even need this?
async def maybe_open_runtime( # @acm
loglevel: Optional[str] = None, # async def maybe_open_runtime(
**kwargs, # loglevel: Optional[str] = None,
# **kwargs,
) -> None: # ) -> None:
''' # '''
Start the ``tractor`` runtime (a root actor) if none exists. # Start the ``tractor`` runtime (a root actor) if none exists.
''' # '''
name = kwargs.pop('name') # name = kwargs.pop('name')
if not tractor.current_actor(err_on_no_runtime=False): # if not tractor.current_actor(err_on_no_runtime=False):
async with open_piker_runtime( # async with open_piker_runtime(
name, # name,
loglevel=loglevel, # loglevel=loglevel,
**kwargs, # **kwargs,
) as (_, addr): # ) as (_, addr):
yield addr, # yield addr,
else: # else:
async with open_registry() as addr: # async with open_registry() as addr:
yield addr # yield addr
@acm @acm
@ -274,6 +278,7 @@ async def maybe_open_pikerd(
registry_addr: None | tuple = None, registry_addr: None | tuple = None,
tsdb: bool = False, tsdb: bool = False,
es: bool = False, es: bool = False,
drop_root_perms_for_ahab: bool = True,
**kwargs, **kwargs,
@ -288,7 +293,10 @@ async def maybe_open_pikerd(
get_console_log(loglevel) get_console_log(loglevel)
# subtle, we must have the runtime up here or portal lookup will fail # subtle, we must have the runtime up here or portal lookup will fail
query_name = kwargs.pop('name', f'piker_query_{os.getpid()}') query_name = kwargs.pop(
'name',
f'piker_query_{os.getpid()}',
)
# TODO: if we need to make the query part faster we could not init # TODO: if we need to make the query part faster we could not init
# an actor runtime and instead just hit the socket? # an actor runtime and instead just hit the socket?
@ -324,9 +332,13 @@ async def maybe_open_pikerd(
loglevel=loglevel, loglevel=loglevel,
debug_mode=kwargs.get('debug_mode', False), debug_mode=kwargs.get('debug_mode', False),
registry_addr=registry_addr, registry_addr=registry_addr,
# ahabd (docker super) specific controls
tsdb=tsdb, tsdb=tsdb,
es=es, es=es,
drop_root_perms_for_ahab=drop_root_perms_for_ahab,
# passthrough to ``tractor`` init
**kwargs, **kwargs,
) as service_manager: ) as service_manager: