From dab741a80699f86e86c91718872a052cca9bbb25 Mon Sep 17 00:00:00 2001 From: Dan Klein Date: Mon, 24 Aug 2015 13:22:48 +0300 Subject: Fixed dependencies of Control Plane to use external_lib sources --- .../pyzmq-14.7.0/examples/heartbeat/heart.py | 34 ++++++++++++++++++++++ 1 file changed, 34 insertions(+) create mode 100644 external_libs/python/pyzmq-14.7.0/examples/heartbeat/heart.py (limited to 'external_libs/python/pyzmq-14.7.0/examples/heartbeat/heart.py') diff --git a/external_libs/python/pyzmq-14.7.0/examples/heartbeat/heart.py b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/heart.py new file mode 100644 index 00000000..175370ef --- /dev/null +++ b/external_libs/python/pyzmq-14.7.0/examples/heartbeat/heart.py @@ -0,0 +1,34 @@ +#!/usr/bin/env python +"""This launches an echoing rep socket device, +and runs a blocking numpy action. The rep socket should +remain responsive to pings during this time. Use heartbeater.py to +ping this heart, and see the responsiveness. + +Authors +------- +* MinRK +""" + +import time +import numpy +import zmq +from zmq import devices + +ctx = zmq.Context() + +dev = devices.ThreadDevice(zmq.FORWARDER, zmq.SUB, zmq.DEALER) +dev.setsockopt_in(zmq.SUBSCRIBE, "") +dev.connect_in('tcp://127.0.0.1:5555') +dev.connect_out('tcp://127.0.0.1:5556') +dev.start() + +#wait for connections +time.sleep(1) + +A = numpy.random.random((2**11,2**11)) +print "starting blocking loop" +while True: + tic = time.time() + numpy.dot(A,A.transpose()) + print "blocked for %.3f s"%(time.time()-tic) + -- cgit 1.2.3-korg