From adf16c9059e94ebbc755a6aaab631b11e7d8fbe8 Mon Sep 17 00:00:00 2001 From: hkc Date: Tue, 9 Jul 2024 14:47:59 +0300 Subject: [PATCH] Config from args --- swarm/manager.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/swarm/manager.py b/swarm/manager.py index f40954e..06783aa 100644 --- a/swarm/manager.py +++ b/swarm/manager.py @@ -423,9 +423,9 @@ class Manager: self.shmem.unlink() -async def main(): +async def main(cfg_path: str = "./settings.json", *_): print(f"PID: {os.getpid()}") - async with Manager("./settings.json") as mgr: + async with Manager(cfg_path) as mgr: signal.signal(signal.SIGUSR1, mgr.on_sigusr1) signal.signal(signal.SIGUSR2, mgr.on_sigusr2) @@ -437,4 +437,5 @@ async def main(): if __name__ == "__main__": - asyncio.run(main()) + from sys import argv + asyncio.run(main(*argv[1:]))