artiq/frontend/artiq_ctlid.py

31 lines
831 B
Python
Raw Normal View History

2014-10-28 15:45:56 +08:00
#!/usr/bin/env python3
import argparse
from artiq.management.pc_rpc import Client
def _get_args():
parser = argparse.ArgumentParser(
description="ARTIQ controller identification tool")
parser.add_argument("server",
help="hostname or IP of the controller to connect to")
parser.add_argument("port", type=int,
help="TCP port to use to connect to the controller")
return parser.parse_args()
def main():
args = _get_args()
remote = Client(args.server, args.port, None)
try:
2014-12-31 20:13:10 +08:00
target_names, id_parameters = remote.get_rpc_id()
2014-10-28 15:45:56 +08:00
finally:
remote.close_rpc()
2014-12-31 20:13:10 +08:00
print("Target(s): " + ", ".join(target_names))
if id_parameters is not None:
print("Parameters: " + id_parameters)
2014-10-28 15:45:56 +08:00
if __name__ == "__main__":
main()