forked from M-Labs/artiq
1
0
Fork 0

core device logging controller WIP (#691)

This commit is contained in:
Sebastien Bourdeauducq 2017-05-22 16:48:00 +08:00
parent 5ccca74a3f
commit 6bdb76e9ea
6 changed files with 122 additions and 40 deletions

View File

@ -38,6 +38,11 @@ Release notes
* Controllers are now named ``aqctl_XXX`` instead of ``XXX_controller``.
* In the device database, the "comm" device has been folded into the "core" device.
Move the "host" argument into the "core" device, and remove the "comm" device.
* The core device log now contains important information about events such as
RTIO collisions. A new controller ``aqctl_corelog`` must be running to forward
those logs to the master. See the example device databases to see how to
instantiate this controller. Using ``artiq_session`` ensures that a controller
manager is running simultaneously with the master.
2.3

View File

@ -2,12 +2,20 @@
# The RTIO channel numbers here are for NIST CLOCK on KC705.
# The list of devices here is not exhaustive.
core_addr = "kc705.lab.m-labs.hk"
device_db = {
"core": {
"type": "local",
"module": "artiq.coredevice.core",
"class": "Core",
"arguments": {"host": "kc705.lab.m-labs.hk", "ref_period": 2e-9}
"arguments": {"host": core_addr, "ref_period": 2e-9}
},
"core_log": {
"type": "controller",
"host": "::1",
"port": 1068,
"command": "aqctl_corelog -p {port} --bind {bind} " + core_addr
},
"core_cache": {
"type": "local",

View File

@ -2,12 +2,20 @@
# The RTIO channel numbers here are for NIST CLOCK on KC705.
# The list of devices here is not exhaustive.
core_addr = "kc705.lab.m-labs.hk"
device_db = {
"core": {
"type": "local",
"module": "artiq.coredevice.core",
"class": "Core",
"arguments": {"host": "kc705.lab.m-labs.hk", "ref_period": 1e-9}
"arguments": {"host": core_addr, "ref_period": 1e-9}
},
"core_log": {
"type": "controller",
"host": "::1",
"port": 1068,
"command": "aqctl_corelog -p {port} --bind {bind} " + core_addr
},
"core_cache": {
"type": "local",

View File

@ -1,14 +1,19 @@
# The RTIO channel numbers here are for Phaser on KC705.
core_addr = "kc705aux.lab.m-labs.hk"
device_db = {
"core": {
"type": "local",
"module": "artiq.coredevice.core",
"class": "Core",
"arguments": {
"host": "kc705aux.lab.m-labs.hk",
"ref_period": 5e-9/6
}
"arguments": {"host": core_addr, "ref_period": 5e-9/6}
},
"core_log": {
"type": "controller",
"host": "::1",
"port": 1068,
"command": "aqctl_corelog -p {port} --bind {bind} " + core_addr
},
"core_cache": {
"type": "local",

55
artiq/frontend/aqctl_corelog.py Executable file
View File

@ -0,0 +1,55 @@
#!/usr/bin/env python3
import argparse
import asyncio
from artiq.protocols.pc_rpc import Server
from artiq.tools import *
def get_argparser():
parser = argparse.ArgumentParser(
description="ARTIQ controller for core device logs")
simple_network_args(parser, 1068)
parser.add_argument("core_addr",
help="hostname or IP address of the core device")
verbosity_args(parser)
return parser
class PingTarget:
def ping(self):
return True
async def get_logs(host):
while True:
print("TODO: not implemented. host:", host)
await asyncio.sleep(2)
def main():
args = get_argparser().parse_args()
init_logger(args)
loop = asyncio.get_event_loop()
try:
get_logs_task = asyncio.ensure_future(get_logs(args.core_addr))
try:
server = Server({"corelog": PingTarget()}, None, True)
loop.run_until_complete(server.start(bind_address_from_args(args), args.port))
try:
loop.run_until_complete(server.wait_terminate())
finally:
loop.run_until_complete(server.stop())
finally:
get_logs_task.cancel()
try:
loop.run_until_complete(get_logs_task)
except asyncio.CancelledError:
pass
finally:
loop.close()
if __name__ == "__main__":
main()

View File

@ -1,37 +1,38 @@
Default network ports
=====================
+--------------------------+--------------+
| Component | Default port |
+==========================+==============+
| Core device (management) | 1380 |
+--------------------------+--------------+
| Core device (main) | 1381 |
+--------------------------+--------------+
| Core device (analyzer) | 1382 |
+--------------------------+--------------+
| Core device (mon/inj) | 1383 |
+--------------------------+--------------+
| Master (logging input) | 1066 |
+--------------------------+--------------+
| Master (broadcasts) | 1067 |
+--------------------------+--------------+
| InfluxDB bridge | 3248 |
+--------------------------+--------------+
| Controller manager | 3249 |
+--------------------------+--------------+
| Master (notifications) | 3250 |
+--------------------------+--------------+
| Master (control) | 3251 |
+--------------------------+--------------+
| PDQ2 | 3252 |
+--------------------------+--------------+
| LDA | 3253 |
+--------------------------+--------------+
| Novatech 409B | 3254 |
+--------------------------+--------------+
| Thorlabs T-Cube | 3255 |
+--------------------------+--------------+
| Korad KA3005P | 3256 |
+--------------------------+--------------+
+--------------------------------+--------------+
| Component | Default port |
+================================+==============+
| Core device (management) | 1380 |
+--------------------------------+--------------+
| Core device (main) | 1381 |
+--------------------------------+--------------+
| Core device (analyzer) | 1382 |
+--------------------------------+--------------+
| Core device (mon/inj) | 1383 |
+--------------------------------+--------------+
| Master (logging input) | 1066 |
+--------------------------------+--------------+
| Master (broadcasts) | 1067 |
+--------------------------------+--------------|
| Core device logging controller | 1068 |
+--------------------------------+--------------+
| InfluxDB bridge | 3248 |
+--------------------------------+--------------+
| Controller manager | 3249 |
+--------------------------------+--------------+
| Master (notifications) | 3250 |
+--------------------------------+--------------+
| Master (control) | 3251 |
+--------------------------------+--------------+
| PDQ2 | 3252 |
+--------------------------------+--------------+
| LDA | 3253 |
+--------------------------------+--------------+
| Novatech 409B | 3254 |
+--------------------------------+--------------+
| Thorlabs T-Cube | 3255 |
+--------------------------------+--------------+
| Korad KA3005P | 3256 |
+--------------------------------+--------------+