From 74856c151b37792ac60495b3021d895983ef35ae Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Sat, 25 Oct 2014 11:34:52 +0800 Subject: [PATCH] artiqd: add bind parameters --- frontend/artiqd | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/frontend/artiqd b/frontend/artiqd index 8fe175fbd..dc83c13e9 100755 --- a/frontend/artiqd +++ b/frontend/artiqd @@ -1,6 +1,7 @@ #!/usr/bin/env python3 import asyncio +import argparse from artiq.management.pc_rpc import Server, WaitQuit from artiq.management.scheduler import Scheduler @@ -15,7 +16,19 @@ class Master(WaitQuit): self.scheduler.run_once(run_params, timeout) +def _get_args(): + parser = argparse.ArgumentParser(description="PDQ2 controller") + parser.add_argument( + "--bind", default="::1", + help="hostname or IP address to bind to") + parser.add_argument( + "--port", default=8888, type=int, + help="TCP port to listen to") + return parser.parse_args() + + def main(): + args = _get_args() loop = asyncio.get_event_loop() try: scheduler = Scheduler() @@ -23,7 +36,7 @@ def main(): try: master = Master(scheduler) server = Server(master) - loop.run_until_complete(server.start("::1", 8888)) + loop.run_until_complete(server.start(args.bind, args.port)) try: loop.run_until_complete(master.wait_quit()) finally: