Set `registry_addrs` in CLI (click) context-config

Since `tractor` and our runtime internals is now moved to multihomed semantics,
do the same in the CLI / config entrypoints.

Also, try using the new `tractor.devx.maybe_open_crash_handler()` around
the `pikerd` CLI.
distribute_dis
Tyler Goodlet 2023-10-01 15:42:31 -04:00
parent 7258d57c69
commit e139d2e259
2 changed files with 12 additions and 7 deletions

View File

@ -87,8 +87,8 @@ def pikerd(
Spawn the piker broker-daemon. Spawn the piker broker-daemon.
''' '''
from cornerboi._debug import open_crash_handler from tractor.devx import maybe_open_crash_handler
with open_crash_handler(): with maybe_open_crash_handler(pdb=pdb):
log = get_console_log(loglevel, name='cli') log = get_console_log(loglevel, name='cli')
if pdb: if pdb:
@ -241,10 +241,14 @@ def cli(
} }
assert brokermods assert brokermods
regaddr: tuple[str, int] = ( # TODO: load endpoints from `conf::[network].pikerd`
# - pikerd vs. regd, separate registry daemon?
# - expose datad vs. brokerd?
# - bind emsd with certain perms on public iface?
regaddrs: list[tuple[str, int]] = [(
_default_registry_host, _default_registry_host,
_default_registry_port, _default_registry_port,
) )]
ctx.obj.update({ ctx.obj.update({
'brokers': brokers, 'brokers': brokers,
@ -254,7 +258,7 @@ def cli(
'log': get_console_log(loglevel), 'log': get_console_log(loglevel),
'confdir': config._config_dir, 'confdir': config._config_dir,
'wl_path': config._watchlists_data_path, 'wl_path': config._watchlists_data_path,
'registry_addr': regaddr, 'registry_addrs': regaddrs,
}) })
# allow enabling same loglevel in ``tractor`` machinery # allow enabling same loglevel in ``tractor`` machinery

View File

@ -146,7 +146,8 @@ def chart(
pdb: bool, pdb: bool,
): ):
''' '''
Start a real-time chartng UI Run chart UI app, spawning service daemons dynamically as
needed if not discovered via [network] config.
''' '''
# eg. ``--profile 3`` reports profiling for anything slower then 3 ms. # eg. ``--profile 3`` reports profiling for anything slower then 3 ms.
@ -181,6 +182,6 @@ def chart(
'debug_mode': pdb, 'debug_mode': pdb,
'loglevel': tractorloglevel, 'loglevel': tractorloglevel,
'name': 'chart', 'name': 'chart',
'registry_addr': config.get('registry_addr'), 'registry_addrs': config.get('registry_addrs'),
}, },
) )