Skip to content

Commit 24a7e3f

Browse files
committed
debug client for keyboard interruption
1 parent 4ef9750 commit 24a7e3f

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

daq-zmq-client.py

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -123,11 +123,11 @@ def get_comma_separated_args(option, opt, value, parser):
123123
# outputFile.write(byteArray)
124124

125125
cmd="PROCESS_AND_PUSH_N_EVENTS"
126-
puller=context.socket(zmq.PULL)
127-
puller.connect("tcp://"+glb_options['serverIpAdress']+":5556")
128126
socket.send(cmd)
129127
mes=socket.recv()
130128
print(mes)
129+
puller=context.socket(zmq.PULL)
130+
puller.connect("tcp://"+glb_options['serverIpAdress']+":5556")
131131
try:
132132
while True:
133133
for i in xrange(0,daq_options['nEvent']):
@@ -138,17 +138,15 @@ def get_comma_separated_args(option, opt, value, parser):
138138
if options.dataNotSaved==False:
139139
outputFile.write(byteArray)
140140
puller.close()
141-
141+
socket.send("END_OF_RUN")
142+
if socket.recv()=="CLOSING_SERVER":
143+
socket.close()
144+
context.term()
145+
break
146+
142147
except KeyboardInterrupt:
143-
puller.close()
144-
socket.send("END_OF_RUN")
145-
if socket.recv()=="CLOSING_SERVER":
146-
socket.close()
147-
context.term()
148+
print("keyboard interruption")
149+
os.system("ssh -T pi@"+glb_options['serverIpAdress']+" \" killall python\"")
148150

149-
socket.send("END_OF_RUN")
150-
if socket.recv()=="CLOSING_SERVER":
151-
socket.close()
152-
context.term()
153151

154152

daq-zmq-server.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@
6363
socket.send("start to process and push the events")
6464
print("start to process and push the events")
6565
for i in xrange(daq_options['nEvent']):
66-
#print("Sending event %d",i)
6766
rawdata=theDaq.processEvent()
6867
pdata=packer.pack(*rawdata)
6968
pusher.send(pdata)
@@ -78,5 +77,6 @@
7877

7978
except KeyboardInterrupt:
8079
print('\nClosing server')
80+
pusher.close()
8181
socket.close()
8282
context.term()

0 commit comments

Comments
 (0)