pyzmq

Limiting queue length with PyZMQ

╄→尐↘猪︶ㄣ 提交于 2019-11-30 21:04:21
I want to limit the amount of memory consumed by my ZeroMQ message queues in a Python application. I know that setting the high-water mark will limit the amount that will be queued on the sender side, but is there a way to control how much will be queued on the receiver side? The Python ZeroMQ binding seems to have it set at unlimited. My test scenario: I have two python terminals that I am using for testing. One is the receiver: Python 2.5.1 (r251:54863, Aug 25 2008, 20:50:04) [GCC 4.1.2 20071124 (Red Hat 4.1.2-42)] on linux2 Type "help", "copyright", "credits" or "license" for more

What is the difference between using ZMQ PUB with .connect() or .bind() methods?

一个人想着一个人 提交于 2019-11-30 17:44:26
问题 In Python ZMQ publisher/subscriber sample template, the publisher uses .bind() method and the subscriber uses .connect() method, that connected to the bind IP address. But we can replace .bind() and .connect() each with the other. My question is that what is the difference between two cases that determined below? (two scripts in these cases work fine) The first case, as default: pub1.py: import zmq import time from datetime import datetime def create_pub_socket(): context = zmq.Context()

zmq send with NOBLOCK raise Resource temporarily unavailable

笑着哭i 提交于 2019-11-30 07:23:36
This code will raise Resource temporarily unavailable when call with NOBLOCK: context = zmq.Context() sender = context.socket(zmq.PUSH) sender.bind('tcp://*:15556') sender.send('KeEpAliv', zmq.NOBLOCK) # this line will throw exception #sender.send('KeEpAliv') # this line will ok After read the docs , I found no hints for this. but docs for recv explained this flag. Python wrappers raise zmq.error.Again if the underlying C API returns EAGAIN . Now, you should follow to zmq_send documentation, which states: ZMQ_NOBLOCK Specifies that the operation should be performed in non-blocking mode. If the

Limiting queue length with PyZMQ

ぐ巨炮叔叔 提交于 2019-11-30 05:39:27
问题 I want to limit the amount of memory consumed by my ZeroMQ message queues in a Python application. I know that setting the high-water mark will limit the amount that will be queued on the sender side, but is there a way to control how much will be queued on the receiver side? The Python ZeroMQ binding seems to have it set at unlimited. My test scenario: I have two python terminals that I am using for testing. One is the receiver: Python 2.5.1 (r251:54863, Aug 25 2008, 20:50:04) [GCC 4.1.2

Pyzmq high-water mark not working on pub socket

允我心安 提交于 2019-11-29 16:57:58
According to the ZeroMQ documentation a pub socket is supposed to drop messages once the number of queued messages reaches the high-water mark. This doesn't seem to work in the following example (and yes I do set the hwm before bind/connect): import time import pickle from threading import Thread import zmq ctx = zmq.Context() def pub_thread(): pub = ctx.socket(zmq.PUB) pub.set_hwm(2) pub.bind('tcp://*:5555') i = 0 while True: # Send message every 100ms time.sleep(0.1) pub.send_string("test", zmq.SNDMORE) pub.send_pyobj(i) i += 1 def sub_thread(): sub = ctx.socket(zmq.SUB) sub.subscribe("test"

ZeroMQ/ZMQ Push/Pull pattern usefulness

断了今生、忘了曾经 提交于 2019-11-28 16:39:57
In experimenting with the ZeroMQ Push/Pull (what they call Pipeline ) socket type, I'm having difficulty understanding the utility of this pattern. It's billed as a "load-balancer". Given a single server sending tasks to a number of workers, Push/Pull will evenly hand out the tasks between all the clients. 3 clients and 30 tasks, each client gets 10 tasks: client1 gets tasks 1, 4, 7,... client2, 2, 5,... and so on. Fair enough. Literally. However, in practice there is often a non-homogeneous mix of task complexity or client compute resources (or availability), then this pattern breaks badly.

Pyzmq high-water mark not working on pub socket

旧巷老猫 提交于 2019-11-28 11:06:34
问题 According to the ZeroMQ documentation a pub socket is supposed to drop messages once the number of queued messages reaches the high-water mark. This doesn't seem to work in the following example (and yes I do set the hwm before bind/connect): import time import pickle from threading import Thread import zmq ctx = zmq.Context() def pub_thread(): pub = ctx.socket(zmq.PUB) pub.set_hwm(2) pub.bind('tcp://*:5555') i = 0 while True: # Send message every 100ms time.sleep(0.1) pub.send_string("test",

Connecting to a remote IPython instance

旧时模样 提交于 2019-11-27 06:19:39
I would like to run an IPython instance on one machine and connect to it (over LAN) from a different process (to run some python commands). I understand that it is possible with zmq : http://ipython.org/ipython-doc/dev/development/ipythonzmq.html . However, I can not find documentation on how to do it and whether it is even possible yet. Any help would be appreciated! EDIT I would like to be able to connect to IPython kernel instance and send it python commands. However, this should not be done via a graphic tool (qtconsole) , but I want to be able to connect to that kernel instance from

Connecting to a remote IPython instance

穿精又带淫゛_ 提交于 2019-11-26 11:57:05
问题 I would like to run an IPython instance on one machine and connect to it (over LAN) from a different process (to run some python commands). I understand that it is possible with zmq : http://ipython.org/ipython-doc/dev/development/ipythonzmq.html . However, I can not find documentation on how to do it and whether it is even possible yet. Any help would be appreciated! EDIT I would like to be able to connect to IPython kernel instance and send it python commands. However, this should not be