forked from M-Labs/artiq
controller manager skeleton
This commit is contained in:
parent
2f06574381
commit
17685d1e98
40
artiq/frontend/artiq_ctlmgr.py
Executable file
40
artiq/frontend/artiq_ctlmgr.py
Executable 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()
|
@ -21,3 +21,10 @@ GUI client
|
||||
.. argparse::
|
||||
:ref: artiq.frontend.artiq_gui.get_argparser
|
||||
:prog: artiq_gui
|
||||
|
||||
Controller manager
|
||||
------------------
|
||||
|
||||
.. argparse::
|
||||
:ref: artiq.frontend.artiq_ctlmgr.get_argparser
|
||||
:prog: artiq_ctlmgr
|
||||
|
1
setup.py
1
setup.py
@ -28,6 +28,7 @@ setup(
|
||||
"console_scripts": [
|
||||
"artiq_client=artiq.frontend.artiq_client:main",
|
||||
"artiq_ctlid=artiq.frontend.artiq_ctlid:main",
|
||||
"artiq_ctlmgr=artiq.frontend.artiq_ctlmgr:main",
|
||||
"artiq_gui=artiq.frontend.artiq_gui:main",
|
||||
"artiq_master=artiq.frontend.artiq_master:main",
|
||||
"artiq_run=artiq.frontend.artiq_run:main",
|
||||
|
Loading…
Reference in New Issue
Block a user