Make `rpc_modules` a positional arg to `tractor.run_daemon()`

multi_program_tests
Tyler Goodlet 2018-09-10 21:56:40 -04:00
parent 037c4c3797
commit 827a6c6014
2 changed files with 7 additions and 5 deletions

View File

@ -24,7 +24,7 @@ def sig_prog(proc, sig):
def daemon(loglevel, testdir, arb_addr): def daemon(loglevel, testdir, arb_addr):
cmdargs = [ cmdargs = [
sys.executable, '-c', sys.executable, '-c',
"import tractor; tractor.run_daemon(arbiter_addr={}, loglevel={})" "import tractor; tractor.run_daemon((), arbiter_addr={}, loglevel={})"
.format( .format(
arb_addr, arb_addr,
"'{}'".format(loglevel) if loglevel else None) "'{}'".format(loglevel) if loglevel else None)

View File

@ -97,12 +97,14 @@ def run(
def run_daemon( def run_daemon(
rpc_modules: Optional[Tuple[str]] = None, rpc_modules: Tuple[str],
**kwargs **kwargs
) -> None: ) -> None:
for path in rpc_modules or (): """Spawn a single daemon-actor which will repond to RPC.
importlib.import_module(path) """
kwargs['rpc_module_paths'] = rpc_modules kwargs['rpc_module_paths'] = rpc_modules
for path in rpc_modules:
importlib.import_module(path)
return run(partial(trio.sleep, float('inf')), **kwargs) return run(partial(trio.sleep, float('inf')), **kwargs)