From 827a6c60147cf4decdd38a7192b302ba51f8e6ec Mon Sep 17 00:00:00 2001 From: Tyler Goodlet Date: Mon, 10 Sep 2018 21:56:40 -0400 Subject: [PATCH] Make `rpc_modules` a positional arg to `tractor.run_daemon()` --- tests/test_multi_program.py | 2 +- tractor/__init__.py | 10 ++++++---- 2 files changed, 7 insertions(+), 5 deletions(-) diff --git a/tests/test_multi_program.py b/tests/test_multi_program.py index dc3d7cf..b13b80b 100644 --- a/tests/test_multi_program.py +++ b/tests/test_multi_program.py @@ -24,7 +24,7 @@ def sig_prog(proc, sig): def daemon(loglevel, testdir, arb_addr): cmdargs = [ sys.executable, '-c', - "import tractor; tractor.run_daemon(arbiter_addr={}, loglevel={})" + "import tractor; tractor.run_daemon((), arbiter_addr={}, loglevel={})" .format( arb_addr, "'{}'".format(loglevel) if loglevel else None) diff --git a/tractor/__init__.py b/tractor/__init__.py index 9742b72..f6100f7 100644 --- a/tractor/__init__.py +++ b/tractor/__init__.py @@ -97,12 +97,14 @@ def run( def run_daemon( - rpc_modules: Optional[Tuple[str]] = None, + rpc_modules: Tuple[str], **kwargs ) -> None: - for path in rpc_modules or (): - importlib.import_module(path) - + """Spawn a single daemon-actor which will repond to RPC. + """ kwargs['rpc_module_paths'] = rpc_modules + for path in rpc_modules: + importlib.import_module(path) + return run(partial(trio.sleep, float('inf')), **kwargs)