forked from M-Labs/artiq
1
0
Fork 0

controller manager skeleton

This commit is contained in:
Sebastien Bourdeauducq 2015-02-06 12:17:51 +08:00
parent 2f06574381
commit 17685d1e98
3 changed files with 48 additions and 0 deletions

40
artiq/frontend/artiq_ctlmgr.py Executable file
View File

@ -0,0 +1,40 @@
#!/usr/bin/env python3
import asyncio
import argparse
import os
from artiq.protocols.sync_struct import Subscriber
def get_argparser():
parser = argparse.ArgumentParser(description="ARTIQ controller manager")
parser.add_argument(
"-s", "--server", default="::1",
help="hostname or IP of the master to connect to")
parser.add_argument(
"--port", default=3250, type=int,
help="TCP port to use to connect to the master")
return parser
def main():
args = get_argparser().parse_args()
if os.name == "nt":
loop = asyncio.ProactorEventLoop()
asyncio.set_event_loop(loop)
else:
loop = asyncio.get_event_loop()
try:
subscriber = Subscriber("master_ddb", lambda x: x)
loop.run_until_complete(subscriber.connect(args.server, args.port))
try:
loop.run_forever()
finally:
loop.run_until_complete(subscriber.close())
finally:
loop.close()
if __name__ == "__main__":
main()

View File

@ -21,3 +21,10 @@ GUI client
.. argparse:: .. argparse::
:ref: artiq.frontend.artiq_gui.get_argparser :ref: artiq.frontend.artiq_gui.get_argparser
:prog: artiq_gui :prog: artiq_gui
Controller manager
------------------
.. argparse::
:ref: artiq.frontend.artiq_ctlmgr.get_argparser
:prog: artiq_ctlmgr

View File

@ -28,6 +28,7 @@ setup(
"console_scripts": [ "console_scripts": [
"artiq_client=artiq.frontend.artiq_client:main", "artiq_client=artiq.frontend.artiq_client:main",
"artiq_ctlid=artiq.frontend.artiq_ctlid:main", "artiq_ctlid=artiq.frontend.artiq_ctlid:main",
"artiq_ctlmgr=artiq.frontend.artiq_ctlmgr:main",
"artiq_gui=artiq.frontend.artiq_gui:main", "artiq_gui=artiq.frontend.artiq_gui:main",
"artiq_master=artiq.frontend.artiq_master:main", "artiq_master=artiq.frontend.artiq_master:main",
"artiq_run=artiq.frontend.artiq_run:main", "artiq_run=artiq.frontend.artiq_run:main",