Fix `piker services`; `tractor.run()` is done..
parent
28535fa977
commit
74910ba56c
|
@ -138,25 +138,26 @@ def cli(ctx, brokers, loglevel, tl, configdir):
|
||||||
@click.pass_obj
|
@click.pass_obj
|
||||||
def services(config, tl, names):
|
def services(config, tl, names):
|
||||||
|
|
||||||
async def list_services():
|
from .._daemon import open_piker_runtime
|
||||||
|
|
||||||
async with tractor.get_arbiter(
|
async def list_services():
|
||||||
|
async with (
|
||||||
|
open_piker_runtime(
|
||||||
|
name='service_query',
|
||||||
|
loglevel=config['loglevel'] if tl else None,
|
||||||
|
),
|
||||||
|
tractor.get_arbiter(
|
||||||
*_tractor_kwargs['arbiter_addr']
|
*_tractor_kwargs['arbiter_addr']
|
||||||
) as portal:
|
) as portal
|
||||||
|
):
|
||||||
registry = await portal.run_from_ns('self', 'get_registry')
|
registry = await portal.run_from_ns('self', 'get_registry')
|
||||||
json_d = {}
|
json_d = {}
|
||||||
for key, socket in registry.items():
|
for key, socket in registry.items():
|
||||||
# name, uuid = uid
|
|
||||||
host, port = socket
|
host, port = socket
|
||||||
json_d[key] = f'{host}:{port}'
|
json_d[key] = f'{host}:{port}'
|
||||||
click.echo(f"{colorize_json(json_d)}")
|
click.echo(f"{colorize_json(json_d)}")
|
||||||
|
|
||||||
tractor.run(
|
trio.run(list_services)
|
||||||
list_services,
|
|
||||||
name='service_query',
|
|
||||||
loglevel=config['loglevel'] if tl else None,
|
|
||||||
arbiter_addr=_tractor_kwargs['arbiter_addr'],
|
|
||||||
)
|
|
||||||
|
|
||||||
|
|
||||||
def _load_clis() -> None:
|
def _load_clis() -> None:
|
||||||
|
|
Loading…
Reference in New Issue