Fix `TIPC` two-host service example
A registrar root does not register itself in its own actor-name registry, so host B could never discover the advertised `host_a`. Boot that service as a child actor under the `TIPC` registrar instead. Import and pass the enabled `echo` callable to `.open_context()`; the prior module-path string could not produce a `NamespacePath`. Review: PR #493 (copilot-pull-request-reviewer[bot],goodboy) https://github.com/goodboy/tractor/pull/493 (this patch was generated in some part by `opencode` using `gpt-5.6-sol` (`openai`))wkt/pr493_review
parent
be6f9e86d1
commit
c1501a36d5
|
|
@ -47,14 +47,16 @@ async def main() -> None:
|
||||||
reg: TIPCAddress = TIPCAddress.get_root()
|
reg: TIPCAddress = TIPCAddress.get_root()
|
||||||
print(f'host A publishing {reg}')
|
print(f'host A publishing {reg}')
|
||||||
|
|
||||||
async with tractor.open_root_actor(
|
async with tractor.open_nursery(
|
||||||
name='host_a',
|
|
||||||
enable_transports=['tipc'],
|
enable_transports=['tipc'],
|
||||||
registry_addrs=[reg.unwrap()],
|
registry_addrs=[reg.unwrap()],
|
||||||
enable_modules=[__name__],
|
) as an:
|
||||||
):
|
await an.start_actor(
|
||||||
|
'host_a',
|
||||||
|
enable_modules=[__name__],
|
||||||
|
)
|
||||||
print(
|
print(
|
||||||
'registrar up — `tipc nametable show` on EITHER host\n'
|
'host_a up — `tipc nametable show` on EITHER host\n'
|
||||||
'should now list this service. ctrl-c to stop.'
|
'should now list this service. ctrl-c to stop.'
|
||||||
)
|
)
|
||||||
await trio.sleep_forever()
|
await trio.sleep_forever()
|
||||||
|
|
|
||||||
|
|
@ -16,6 +16,7 @@ from __future__ import annotations
|
||||||
|
|
||||||
import trio
|
import trio
|
||||||
import tractor
|
import tractor
|
||||||
|
from host_a_srv import echo
|
||||||
from tractor.ipc._tipc import (
|
from tractor.ipc._tipc import (
|
||||||
TIPCAddress,
|
TIPCAddress,
|
||||||
is_tipc_available,
|
is_tipc_available,
|
||||||
|
|
@ -41,7 +42,7 @@ async def main() -> None:
|
||||||
|
|
||||||
async with (
|
async with (
|
||||||
ptl.open_context(
|
ptl.open_context(
|
||||||
'host_a_srv:echo',
|
echo,
|
||||||
) as (ctx, _),
|
) as (ctx, _),
|
||||||
ctx.open_stream() as stream,
|
ctx.open_stream() as stream,
|
||||||
):
|
):
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue