mirror of
https://github.com/m-labs/artiq.git
synced 2024-12-25 11:18:27 +08:00
add session manager (#691)
This commit is contained in:
parent
edef51c6b6
commit
ad85a0cee3
@ -134,7 +134,7 @@ def main():
|
|||||||
bind, args.port_logging))
|
bind, args.port_logging))
|
||||||
atexit_register_coroutine(server_logging.stop)
|
atexit_register_coroutine(server_logging.stop)
|
||||||
|
|
||||||
logger.info("running, bound to %s", bind)
|
print("ARTIQ master is now ready.")
|
||||||
loop.run_forever()
|
loop.run_forever()
|
||||||
|
|
||||||
if __name__ == "__main__":
|
if __name__ == "__main__":
|
||||||
|
52
artiq/frontend/artiq_session.py
Executable file
52
artiq/frontend/artiq_session.py
Executable 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()
|
@ -154,3 +154,7 @@ Front-end tool reference
|
|||||||
.. argparse::
|
.. argparse::
|
||||||
:ref: artiq.frontend.artiq_dashboard.get_argparser
|
:ref: artiq.frontend.artiq_dashboard.get_argparser
|
||||||
:prog: artiq_dashboard
|
:prog: artiq_dashboard
|
||||||
|
|
||||||
|
.. argparse::
|
||||||
|
:ref: artiq.frontend.artiq_session.get_argparser
|
||||||
|
:prog: artiq_session
|
||||||
|
1
setup.py
1
setup.py
@ -31,6 +31,7 @@ console_scripts = [
|
|||||||
"artiq_influxdb=artiq.frontend.artiq_influxdb:main",
|
"artiq_influxdb=artiq.frontend.artiq_influxdb:main",
|
||||||
"artiq_master=artiq.frontend.artiq_master:main",
|
"artiq_master=artiq.frontend.artiq_master:main",
|
||||||
"artiq_mkfs=artiq.frontend.artiq_mkfs:main",
|
"artiq_mkfs=artiq.frontend.artiq_mkfs:main",
|
||||||
|
"artiq_session=artiq.frontend.artiq_session:main",
|
||||||
"artiq_rpctool=artiq.frontend.artiq_rpctool:main",
|
"artiq_rpctool=artiq.frontend.artiq_rpctool:main",
|
||||||
"artiq_run=artiq.frontend.artiq_run:main",
|
"artiq_run=artiq.frontend.artiq_run:main",
|
||||||
"artiq_flash=artiq.frontend.artiq_flash:main",
|
"artiq_flash=artiq.frontend.artiq_flash:main",
|
||||||
|
Loading…
Reference in New Issue
Block a user