forked from M-Labs/artiq
1
0
Fork 0

artiqd: add bind parameters

This commit is contained in:
Sebastien Bourdeauducq 2014-10-25 11:34:52 +08:00
parent b13b77e42f
commit 74856c151b
1 changed files with 14 additions and 1 deletions

View File

@ -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: