Add project name to pyproject.toml and decouple registry from binding addresses #4

Open
jc211 wants to merge 2 commits from jc211/tractor:runtime_to_msgspec into runtime_to_msgspec
2 changed files with 7 additions and 8 deletions

View File

@ -120,6 +120,7 @@ log_cli = false
# ------ - ------ # ------ - ------
[project] [project]
name = "tractor"
keywords = [ keywords = [
'trio', 'trio',
'async', 'async',

View File

@ -70,6 +70,9 @@ async def open_root_actor(
# defaults are above # defaults are above
arbiter_addr: tuple[str, int]|None = None, arbiter_addr: tuple[str, int]|None = None,
# binding addrs for the transport layer server
trans_bind_addrs: list[tuple[str, int]] = [(_default_host, _default_port)],
name: str|None = 'root', name: str|None = 'root',
# either the `multiprocessing` start method: # either the `multiprocessing` start method:
@ -184,6 +187,8 @@ async def open_root_actor(
) )
assert registry_addrs assert registry_addrs
assert trans_bind_addrs
loglevel = ( loglevel = (
loglevel loglevel
or log._default_loglevel or log._default_loglevel
@ -273,8 +278,6 @@ async def open_root_actor(
tuple(addr), # TODO: just drop this requirement? tuple(addr), # TODO: just drop this requirement?
) )
trans_bind_addrs: list[tuple[str, int]] = []
# Create a new local root-actor instance which IS NOT THE # Create a new local root-actor instance which IS NOT THE
# REGISTRAR # REGISTRAR
if ponged_addrs: if ponged_addrs:
@ -296,11 +299,6 @@ async def open_root_actor(
loglevel=loglevel, loglevel=loglevel,
enable_modules=enable_modules, enable_modules=enable_modules,
) )
# DO NOT use the registry_addrs as the transport server
# addrs for this new non-registar, root-actor.
for host, port in ponged_addrs:
# NOTE: zero triggers dynamic OS port allocation
trans_bind_addrs.append((host, 0))
# Start this local actor as the "registrar", aka a regular # Start this local actor as the "registrar", aka a regular
# actor who manages the local registry of "mailboxes" of # actor who manages the local registry of "mailboxes" of