Skip to content

Commit

Permalink
Begin deprecation of arbiter_addr -> registry_addr
Browse files Browse the repository at this point in the history
  • Loading branch information
goodboy committed Jan 25, 2023
1 parent 588b7ca commit 19bd5f8
Showing 1 changed file with 24 additions and 11 deletions.
35 changes: 24 additions & 11 deletions tractor/_root.py
Original file line number Diff line number Diff line change
Expand Up @@ -58,11 +58,12 @@
@asynccontextmanager
async def open_root_actor(

*,
# defaults are above
arbiter_addr: Optional[tuple[str, int]] = (
_default_arbiter_host,
_default_arbiter_port,
),
arbiter_addr: tuple[str, int] | None = None,

# defaults are above
registry_addr: tuple[str, int] | None = None,

name: Optional[str] = 'root',

Expand Down Expand Up @@ -112,9 +113,21 @@ async def open_root_actor(
if start_method is not None:
_spawn.try_set_start_method(start_method)

arbiter_addr = (host, port) = arbiter_addr or (
_default_arbiter_host,
_default_arbiter_port,
if arbiter_addr is not None:
warnings.warn(
'`arbiter_addr` is now deprecated and has been renamed to'
'`registry_addr`.\nUse that instead..',
DeprecationWarning,
stacklevel=2,
)

registry_addr = (host, port) = (
registry_addr
or arbiter_addr
or (
_default_arbiter_host,
_default_arbiter_port,
)
)

loglevel = (loglevel or log._default_loglevel).upper()
Expand Down Expand Up @@ -170,7 +183,7 @@ async def open_root_actor(

actor = Actor(
name or 'anonymous',
arbiter_addr=arbiter_addr,
arbiter_addr=registry_addr,
loglevel=loglevel,
enable_modules=enable_modules,
)
Expand All @@ -186,7 +199,7 @@ async def open_root_actor(

actor = Arbiter(
name or 'arbiter',
arbiter_addr=arbiter_addr,
arbiter_addr=registry_addr,
loglevel=loglevel,
enable_modules=enable_modules,
)
Expand Down Expand Up @@ -252,7 +265,7 @@ def run_daemon(

# runtime kwargs
name: Optional[str] = 'root',
arbiter_addr: tuple[str, int] = (
registry_addr: tuple[str, int] = (
_default_arbiter_host,
_default_arbiter_port,
),
Expand All @@ -279,7 +292,7 @@ def run_daemon(
async def _main():

async with open_root_actor(
arbiter_addr=arbiter_addr,
arbiter_addr=registry_addr,
name=name,
start_method=start_method,
debug_mode=debug_mode,
Expand Down

0 comments on commit 19bd5f8

Please sign in to comment.