Better document `run_daemon()`

self_register
Tyler Goodlet 2018-09-14 16:33:45 -04:00
parent 85a5d1f849
commit 716a44b6b8
1 changed files with 9 additions and 5 deletions

View File

@ -97,14 +97,18 @@ def run(
def run_daemon( def run_daemon(
rpc_modules: Tuple[str], rpc_module_paths: Tuple[str],
**kwargs **kwargs
) -> None: ) -> None:
"""Spawn a single daemon-actor which will repond to RPC. """Spawn daemon actor which will respond to RPC.
"""
kwargs['rpc_module_paths'] = rpc_modules
for path in rpc_modules: This is a convenience wrapper around
``tractor.run(trio.sleep(float('inf')))`` such that the first actor spawned
is meant to run forever handling to RPC requests.
"""
kwargs['rpc_module_paths'] = rpc_module_paths
for path in rpc_module_paths:
importlib.import_module(path) importlib.import_module(path)
return run(partial(trio.sleep, float('inf')), **kwargs) return run(partial(trio.sleep, float('inf')), **kwargs)