Skip to content

Commit

Permalink
artiq_client: fix 'show log', closes #552
Browse files Browse the repository at this point in the history
sbourdeauducq committed Sep 5, 2016
1 parent 87fad87 commit d571c52
Showing 1 changed file with 6 additions and 26 deletions.
32 changes: 6 additions & 26 deletions artiq/frontend/artiq_client.py
Original file line number Diff line number Diff line change
@@ -13,6 +13,7 @@

from artiq.protocols.pc_rpc import Client
from artiq.protocols.sync_struct import Subscriber
from artiq.protocols.broadcast import Receiver
from artiq.protocols import pyon
from artiq.tools import short_format

@@ -236,8 +237,6 @@ def _show_datasets(datasets):


def _run_subscriber(host, port, subscriber):
if port is None:
port = 3250
loop = asyncio.get_event_loop()
try:
loop.run_until_complete(subscriber.connect(host, port))
@@ -259,7 +258,8 @@ def init_d(x):
return d
subscriber = Subscriber(notifier_name, init_d,
lambda mod: display_fun(d))
_run_subscriber(args.server, args.port, subscriber)
port = 3250 if args.port is None else args.port
_run_subscriber(args.server, port, subscriber)


def _print_log_record(record):
@@ -268,30 +268,10 @@ def _print_log_record(record):
print(level, source, t, message)


class _LogPrinter:
def __init__(self, init):
for record in init:
_print_log_record(record)

def append(self, record):
_print_log_record(record)

def insert(self, i, record):
_print_log_record(record)

def pop(self, i=-1):
pass

def __delitem__(self, x):
pass

def __setitem__(self, k, v):
pass


def _show_log(args):
subscriber = Subscriber("log", _LogPrinter)
_run_subscriber(args.server, args.port, subscriber)
subscriber = Receiver("log", [_print_log_record])
port = 1067 if args.port is None else args.port
_run_subscriber(args.server, port, subscriber)


def main():

0 comments on commit d571c52

Please sign in to comment.