2
0
mirror of https://github.com/m-labs/artiq.git synced 2024-12-26 03:38:25 +08:00
artiq/frontend/artiq

44 lines
1.2 KiB
Python
Executable File

#!/usr/bin/env python3
import argparse
from artiq.management.pc_rpc import Client
def _get_args():
parser = argparse.ArgumentParser(description="ARTIQ client")
parser.add_argument(
"-s", "--server", default="::1",
help="hostname or IP of the master to connect to")
parser.add_argument(
"--port", default=8888, type=int,
help="TCP port to use to connect to the master")
parser.add_argument(
"-o", "--run-once", default=[], nargs=3,
action="append",
help="run experiment once. arguments: <path> <name> <timeout>")
parser.add_argument(
"-q", "--quit-master", default=False,
action="store_true",
help="causes the master to quit")
return parser.parse_args()
def main():
args = _get_args()
remote = Client(args.server, args.port)
try:
for path, name, timeout in args.run_once:
remote.run_once(
{
"path": path,
"name": name
}, int(timeout))
if args.quit_master:
remote.quit()
finally:
remote.close_rpc()
if __name__ == "__main__":
main()