From e139d2e2590d421184265121365b1918d5ec30c9 Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Sun, 1 Oct 2023 15:42:31 -0400 Subject: [PATCH] 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. --- piker/cli/__init__.py | 14 +++++++++----- piker/ui/cli.py | 5 +++-- 2 files changed, 12 insertions(+), 7 deletions(-) diff --git a/piker/cli/__init__.py b/piker/cli/__init__.py index b56defb3..9daa0c56 100644 --- a/piker/cli/__init__.py +++ b/piker/cli/__init__.py @@ -87,8 +87,8 @@ def pikerd( Spawn the piker broker-daemon. ''' - from cornerboi._debug import open_crash_handler - with open_crash_handler(): + from tractor.devx import maybe_open_crash_handler + with maybe_open_crash_handler(pdb=pdb): log = get_console_log(loglevel, name='cli') if pdb: @@ -241,10 +241,14 @@ def cli( } 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_port, - ) + )] ctx.obj.update({ 'brokers': brokers, @@ -254,7 +258,7 @@ def cli( 'log': get_console_log(loglevel), 'confdir': config._config_dir, 'wl_path': config._watchlists_data_path, - 'registry_addr': regaddr, + 'registry_addrs': regaddrs, }) # allow enabling same loglevel in ``tractor`` machinery diff --git a/piker/ui/cli.py b/piker/ui/cli.py index 15b3e9f6..cb97dda9 100644 --- a/piker/ui/cli.py +++ b/piker/ui/cli.py @@ -146,7 +146,8 @@ def chart( 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. @@ -181,6 +182,6 @@ def chart( 'debug_mode': pdb, 'loglevel': tractorloglevel, 'name': 'chart', - 'registry_addr': config.get('registry_addr'), + 'registry_addrs': config.get('registry_addrs'), }, )