def check_events(self, subscriber, socks):
""" Forward external Supervisor events to main thread. """
if subscriber.socket in socks and \
socks[subscriber.socket] == zmq.POLLIN:
try:
message = subscriber.receive()
except:
print >> stderr, '[ERROR] failed to get data from subscriber'
else:
# The events received are not processed directly in this thread
# because it would conflict with the processing in the
# Supervisor thread, as they use the same data.
# That's why a RemoteCommunicationEvent is used to push the
# event in the Supervisor thread.
self.send_remote_comm_event(
RemoteCommEvents.SUPVISORS_EVENT,
json.dumps(message))
评论列表
文章目录