2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-24 10:54:02 +08:00

add session manager (#691)

This commit is contained in:
Sebastien Bourdeauducq 2017-05-15 17:05:22 +08:00
parent edef51c6b6
commit ad85a0cee3
4 changed files with 58 additions and 1 deletions

View File

@ -134,7 +134,7 @@ def main():
bind, args.port_logging))
atexit_register_coroutine(server_logging.stop)
logger.info("running, bound to %s", bind)
print("ARTIQ master is now ready.")
loop.run_forever()
if __name__ == "__main__":

52
artiq/frontend/artiq_session.py Executable file
View File

@ -0,0 +1,52 @@
#!/usr/bin/env python3
import argparse
import sys
import subprocess
def get_argparser():
parser = argparse.ArgumentParser(
description="ARTIQ session manager. "
"Automatically runs the master, dashboard and "
"local controller manager on the current machine.")
parser.add_argument("-m", action="append", default=[],
help="add argument to the master command line")
parser.add_argument("-d", action="append", default=[],
help="add argument to the dashboard command line")
parser.add_argument("-c", action="append", default=[],
help="add argument to the controller manager command line")
return parser
def main():
args = get_argparser().parse_args()
master_cmd = [sys.executable, "-u", "-m", "artiq.frontend.artiq_master"]
dashboard_cmd = [sys.executable, "-m", "artiq.frontend.artiq_dashboard"]
ctlmgr_cmd = [sys.executable, "-m", "artiq.frontend.artiq_ctlmgr"]
master_cmd += args.m
dashboard_cmd += args.d
ctlmgr_cmd += args.c
with subprocess.Popen(master_cmd,
stdout=subprocess.PIPE, universal_newlines=True,
bufsize=1) as master:
master_ready = False
for line in iter(master.stdout.readline, ""):
sys.stdout.write(line)
if line.rstrip() == "ARTIQ master is now ready.":
master_ready = True
break
if master_ready:
with subprocess.Popen(dashboard_cmd):
with subprocess.Popen(ctlmgr_cmd):
for line in iter(master.stdout.readline, ""):
sys.stdout.write(line)
else:
print("session: master failed to start, exiting.")
if __name__ == "__main__":
main()

View File

@ -154,3 +154,7 @@ Front-end tool reference
.. argparse::
:ref: artiq.frontend.artiq_dashboard.get_argparser
:prog: artiq_dashboard
.. argparse::
:ref: artiq.frontend.artiq_session.get_argparser
:prog: artiq_session

View File

@ -31,6 +31,7 @@ console_scripts = [
"artiq_influxdb=artiq.frontend.artiq_influxdb:main",
"artiq_master=artiq.frontend.artiq_master:main",
"artiq_mkfs=artiq.frontend.artiq_mkfs:main",
"artiq_session=artiq.frontend.artiq_session:main",
"artiq_rpctool=artiq.frontend.artiq_rpctool:main",
"artiq_run=artiq.frontend.artiq_run:main",
"artiq_flash=artiq.frontend.artiq_flash:main",