13
13
14
14
from artiq .protocols .pc_rpc import Client
15
15
from artiq .protocols .sync_struct import Subscriber
16
+ from artiq .protocols .broadcast import Receiver
16
17
from artiq .protocols import pyon
17
18
from artiq .tools import short_format
18
19
@@ -236,8 +237,6 @@ def _show_datasets(datasets):
236
237
237
238
238
239
def _run_subscriber (host , port , subscriber ):
239
- if port is None :
240
- port = 3250
241
240
loop = asyncio .get_event_loop ()
242
241
try :
243
242
loop .run_until_complete (subscriber .connect (host , port ))
@@ -259,7 +258,8 @@ def init_d(x):
259
258
return d
260
259
subscriber = Subscriber (notifier_name , init_d ,
261
260
lambda mod : display_fun (d ))
262
- _run_subscriber (args .server , args .port , subscriber )
261
+ port = 3250 if args .port is None else args .port
262
+ _run_subscriber (args .server , port , subscriber )
263
263
264
264
265
265
def _print_log_record (record ):
@@ -268,30 +268,10 @@ def _print_log_record(record):
268
268
print (level , source , t , message )
269
269
270
270
271
- class _LogPrinter :
272
- def __init__ (self , init ):
273
- for record in init :
274
- _print_log_record (record )
275
-
276
- def append (self , record ):
277
- _print_log_record (record )
278
-
279
- def insert (self , i , record ):
280
- _print_log_record (record )
281
-
282
- def pop (self , i = - 1 ):
283
- pass
284
-
285
- def __delitem__ (self , x ):
286
- pass
287
-
288
- def __setitem__ (self , k , v ):
289
- pass
290
-
291
-
292
271
def _show_log (args ):
293
- subscriber = Subscriber ("log" , _LogPrinter )
294
- _run_subscriber (args .server , args .port , subscriber )
272
+ subscriber = Receiver ("log" , [_print_log_record ])
273
+ port = 1067 if args .port is None else args .port
274
+ _run_subscriber (args .server , port , subscriber )
295
275
296
276
297
277
def main ():
0 commit comments