Re: [zeromq-dev] IPC and free ports

2012-10-18 Thread andrea crotti
2012/10/13 Pieter Hintjens piet...@gmail.com: On Oct 12, 2012 6:32 PM, andrea crotti andrea.crott...@gmail.com wrote: But why double binding on IPC doesn't fail, when should that be a good idea? The code explicitly overrides an existing binding on an IPC endpoint so it can recover after

Re: [zeromq-dev] IPC and free ports

2012-10-12 Thread andrea crotti
2012/10/11 Ian Barber ian.bar...@gmail.com: On Thu, Oct 11, 2012 at 5:14 PM, andrea crotti andrea.crott...@gmail.com wrote: So suppose I want to make sure that I'm not binding twice, what should I do? Check if the file already exists or? Yep try: sock.bind(addr) except zmq.Error

[zeromq-dev] catching assertion failed?

2012-10-05 Thread andrea crotti
On my machine everything works fine, but on another machine I get this: Assertion failed: ok (mailbox.cpp:84) Aborted is there a way to catch that error to understand at least where it's coming from (I'm using pyzmq as binding)?? ___ zeromq-dev mailing

[zeromq-dev] logging messages sent

2012-10-01 Thread andrea crotti
We are not sending around so much data, and for debugging and understanding purposes I would like to be able to automatically log to disk all the messages that would be sent around. Ideally writing : sock.send('some message') I should get a log entry DEBUG: sent on channel tcp:/... message ...

Re: [zeromq-dev] Talk about ZeroMQ

2012-10-01 Thread andrea crotti
2012/9/30 Pieter Hintjens p...@imatix.com: Yes, these are the standard questions. To which, some standard answers: - persistence There's no one ideal persistence solution. Build what you need according to the use-case or take 0MQ packages like Majordomo. - security There's no one ideal

Re: [zeromq-dev] logging messages sent

2012-10-01 Thread andrea crotti
2012/10/1 andrea crotti andrea.crott...@gmail.com: We are not sending around so much data, and for debugging and understanding purposes I would like to be able to automatically log to disk all the messages that would be sent around. Ideally writing : sock.send('some message') I should get

Re: [zeromq-dev] Talk about ZeroMQ

2012-09-30 Thread Andrea Crotti
On 09/27/2012 04:10 PM, andrea crotti wrote: Ok I used some of the figures, the RST that generates the slides is here: https://raw.github.com/AndreaCrotti/pyconuk2012_slides/master/zeromq/zeromq.rst I have shown each pattern one by one and then a live example, killing them or adding more

Re: [zeromq-dev] Talk about ZeroMQ

2012-09-30 Thread Andrea Crotti
On 09/30/2012 10:14 PM, Andrea Crotti wrote: On 09/27/2012 04:10 PM, andrea crotti wrote: Ok I used some of the figures, the RST that generates the slides is here: https://raw.github.com/AndreaCrotti/pyconuk2012_slides/master/zeromq/zeromq.rst I have shown each pattern one by one

Re: [zeromq-dev] Talk about ZeroMQ

2012-09-27 Thread andrea crotti
2012/9/25 Michel Pelletier pelletier.mic...@gmail.com: On Tue, Sep 25, 2012 at 2:05 AM, andrea crotti andrea.crott...@gmail.com wrote: The talk will be this Saturday and the slides are finally taking shape.. First question, am I allowed to steal some of the graphs from the official guide

Re: [zeromq-dev] Talk about ZeroMQ

2012-09-25 Thread andrea crotti
The talk will be this Saturday and the slides are finally taking shape.. First question, am I allowed to steal some of the graphs from the official guide?? I'm using hieroglyph to generate the slides in RST, and they are available here: https://github.com/AndreaCrotti/pyconuk2012_slides I

Re: [zeromq-dev] Too much ZeroMQ overhead versus plain TCP Java NIO Epoll (with measurements)

2012-08-30 Thread andrea crotti
2012/8/29 Julie Anderson julie.anderson...@gmail.com: I understand your frustration. I don't put the code here because I don't want to, but because I am legally unable to. If you have a boss or employer you can understand that. :) I will try to come up with a simple version to do the same

Re: [zeromq-dev] Talk about ZeroMQ

2012-08-24 Thread andrea crotti
2012/8/24 Justin Cook jhc...@gmail.com: On Thursday, 23 August 2012 at 20:22, Andrea Crotti wrote: The whole idea behind ZMQ is doing sockets the way the project would like to think sockets should have been done. Why reinvent the wheel when there are messaging patterns that are used over

[zeromq-dev] Talk about ZeroMQ

2012-08-23 Thread andrea crotti
Hi everyone, I'm not 100% sure yet but in the next PyConUK (http://2012.pyconuk.net/) I should give a talk about zeromq.. I decided to propose it because I was going to learn it for work, and I hope I'll be ready for the end of September. Anyway suggestions are welcome, and it would be nice if I

Re: [zeromq-dev] Talk about ZeroMQ

2012-08-23 Thread Andrea Crotti
On 08/23/2012 08:06 PM, Pieter Hintjens wrote: On Thu, Aug 23, 2012 at 7:40 PM, andrea crotti andrea.crott...@gmail.com wrote: What do you think? Anything I can have a look at? There are a lot of multithreading examples in the Guide. If you want to introduce 0MQ, consider this sketch

[zeromq-dev] router/dealer doubts

2012-08-21 Thread andrea crotti
I have some troubles understanding the ROUTER/DEALER sockets.. So first of all let's see if I understood correctly.. ROUTER/DEALER is used for extending REQ/REP, where in other words, if I want to have: - 1 client and multiple server, I add a dealer in between - 1 server and multiple clients, I

Re: [zeromq-dev] router/dealer doubts

2012-08-21 Thread andrea crotti
2012/8/21 Pieter Hintjens p...@imatix.com: On Tue, Aug 21, 2012 at 1:41 PM, Chuck Remes li...@chuckremes.com wrote: http://www.zeromq.org/tutorials:xreq-and-xrep Before we renamed them, DEALER was XREQ and ROUTER was XREP so all of the same information still applies. I've moved that page

Re: [zeromq-dev] design communication protocols

2012-08-20 Thread andrea crotti
Yes SPIN is in general a very good idea, but as Andrew did I don't want to write the modle directly in Promela, because that would mean change it every time I change the code.. If I find a good representation for the network protocol that can also export for SPIN that great, I could use it,

[zeromq-dev] design communication protocols

2012-08-17 Thread andrea crotti
So now I reached the point where (almost) all my processes are nicely configured and they communicate with each other. But now I would like to design good communication protocols between them, because otherwise it will be a mess.. I thought about a protocol between each of the communicating

Re: [zeromq-dev] push/pull and multiple workers

2012-08-17 Thread andrea crotti
You must match a connect with a bind. You cannot have 2 (or more) sockets use zmq_connect to connect to each other. The socket(s) must have something to connect *to* and that is only true when a socket has bound an address. Again, this is just like regular sockets. cr Thanks, and now suppose

Re: [zeromq-dev] push/pull and multiple workers

2012-08-17 Thread andrea crotti
In that situation then you want to use a forwarder device. The forwarder device binds to an incoming and an outgoing port. The publisher(s) connect to the incoming port and the subscriber(s) connect to the outgoing port of the device. All messages flow through the device to the subscribers.

Re: [zeromq-dev] push/pull and multiple workers

2012-08-17 Thread andrea crotti
2012/8/17 Pedro Melo m...@simplicidade.org Hi, On Fri, Aug 17, 2012 at 2:17 PM, andrea crotti andrea.crott...@gmail.com wrote: In that situation then you want to use a forwarder device. The forwarder device binds to an incoming and an outgoing port. The publisher(s) connect

Re: [zeromq-dev] design communication protocols

2012-08-17 Thread andrea crotti
It's starting to slowly make more sense (even if I'm far from convinced), the following code for example has a protocol object that takes a message, and knows how to serialise and unserialise. Usign a simple list I go over all the possible message types to construct the right type, and

Re: [zeromq-dev] Testing and debugging

2012-08-16 Thread andrea crotti
2012/8/14 Michel Pelletier pelletier.mic...@gmail.com: On Tue, Aug 14, 2012 at 7:34 AM, andrea crotti andrea.crott...@gmail.com wrote: 2012/8/13 Michel Pelletier pelletier.mic...@gmail.com: Thanks for the help, any example of how to mock the zmq messages maybe? I was trying to find a way

Re: [zeromq-dev] Keeping processes up and running

2012-08-16 Thread andrea crotti
2012/8/16 Pieter Hintjens p...@imatix.com: Andrea, If these processes are on multiple systems, consider using something like Salt: http://saltstack.com/ -Pieter Ah yes it looks nice I saw that some time ago.. Well at the moment they should run all on the same machine, but thanks to zeromq

Re: [zeromq-dev] Testing and debugging

2012-08-15 Thread andrea crotti
2012/8/14 Michel Pelletier pelletier.mic...@gmail.com: And I'm not sure it's worth actually to mock in this way, instead I could just send message with inproc instead of the TCP connections.. You should look at a mocking library to do the actual mocked objects for you. flexmock, for

[zeromq-dev] push/pull and multiple workers

2012-08-15 Thread andrea crotti
I'm having a few problems with PUSH/PULL and multiple processes, so I tried to make a simple example to understand what's going on, but still is not clear.. In the following example I would expect to receive two tasks from the two different processes and then quit, instead it receives the first

Re: [zeromq-dev] push/pull and multiple workers

2012-08-15 Thread andrea crotti
2012/8/15 andrea crotti andrea.crott...@gmail.com: I'm having a few problems with PUSH/PULL and multiple processes, so I tried to make a simple example to understand what's going on, but still is not clear.. In the following example I would expect to receive two tasks from the two different

Re: [zeromq-dev] push/pull and multiple workers

2012-08-15 Thread andrea crotti
2012/8/15 Apostolis Xekoukoulotakis xekou...@gmail.com: Because by the time the second worker connects, the sender has already sent both messages to the first one. The message is not lost. the first worker simply exits after only one message. Very good makes sense, but then why this also

Re: [zeromq-dev] push/pull and multiple workers

2012-08-15 Thread andrea crotti
2012/8/15 Chuck Remes li...@chuckremes.com: It hangs for the same reason that the first example hangs. The connect action of the two receivers retries asynchronously until they succeed. When either of the receive processes connects, it gets *both* messages. The second receive process

Re: [zeromq-dev] push/pull and multiple workers

2012-08-15 Thread andrea crotti
2012/8/15 Chuck Remes li...@chuckremes.com: Correct, only one socket may bind to a specific address. This is just like a regular socket. Well I understood the reason of my pain, the task submitter and the result socket are both PUSH/PULL, but the first should do a bind/connect, while the

Re: [zeromq-dev] installing on red hat 5.3

2012-08-14 Thread andrea crotti
2012/8/13 andrea crotti andrea.crott...@gmail.com: My bad, true in the tar.gz package I didn't need the autogen.sh, and on centos 5.8 it seems to compile correctly, now I just need to try to copy it over to the centos 5.3 machine and cross my fingers.. Finally solved, I just had to ask

Re: [zeromq-dev] fire up new subscribers

2012-08-14 Thread andrea crotti
I wanted to try now the XPUB pattern and just as a comment, I can't find any example about how to use it, and the only documentation is in the API reference, where it doesn't actually say that much.. Maybe an example would be nice to have in the guide or in the examples directory, what do you

Re: [zeromq-dev] fire up new subscribers

2012-08-14 Thread andrea crotti
2012/8/14 Pieter Hintjens p...@imatix.com: On Tue, Aug 14, 2012 at 9:00 PM, andrea crotti andrea.crott...@gmail.com wrote: Maybe an example would be nice to have in the guide or in the examples directory, what do you think? Yes, when we update the Guide for 3.x... This for example doesn't

Re: [zeromq-dev] fire up new subscribers

2012-08-14 Thread andrea crotti
2012/8/14 Chuck Remes li...@chuckremes.com: You are using undocumented socket types. Unless you feel like digging into the code and figuring this out yourself, I recommend you use socket types that have already been documented. Well I was trying to use what was suggested on this list ;)

Re: [zeromq-dev] Testing and debugging

2012-08-14 Thread andrea crotti
2012/8/13 Michel Pelletier pelletier.mic...@gmail.com: There are generally two approaches I use in Python to test zeromq code. The first is to mock the zmq library with something like flexmock (or one of the many other mocking libraries) and test my message producing/handling code in

[zeromq-dev] Python logging via zeromq

2012-08-13 Thread andrea crotti
I was wondering if it would make sense to redirect the logging messages from my Python program to a zeromq socket, and get them collected and processed by the sink process.. This would allow to write on disk only from one process, and have a real time situation without reading to a file.. The

[zeromq-dev] Testing and debugging

2012-08-13 Thread andrea crotti
Any advices about how to debug and unit test zeromq-based applications (Python in particular)? I have all these processes communicating with each other now, and it's a tricky to set a breakpoint or to add some prints here and there, so what could be a way to go? For automated tesating I was

Re: [zeromq-dev] Python logging via zeromq

2012-08-13 Thread andrea crotti
2012/8/13 Brian Knox bri...@talksum.com: This might interest you: http://zeromq.github.com/pyzmq/logging.html Great, exactly what I wanted to implement, thanks! ___ zeromq-dev mailing list zeromq-dev@lists.zeromq.org

Re: [zeromq-dev] Python logging via zeromq

2012-08-13 Thread andrea crotti
2012/8/13 andrea crotti andrea.crott...@gmail.com: 2012/8/13 Brian Knox bri...@talksum.com: This might interest you: http://zeromq.github.com/pyzmq/logging.html Great, exactly what I wanted to implement, thanks! I can't understand how to actually subscribe to the logger though

[zeromq-dev] Assign tasks only once to subscribers

2012-08-09 Thread andrea crotti
What is the right pattern to split many tasks to many different workers, but where each task can only be taken once?? I thought that the PUB/SUB was fine, and it is as long as I have num_workers tasks, but if I publish only one task for example they all get the same one. Should I maybe use a

Re: [zeromq-dev] Assign tasks only once to subscribers

2012-08-09 Thread andrea crotti
2012/8/9 Ian Barber ian.bar...@gmail.com: On Thu, Aug 9, 2012 at 10:24 AM, andrea crotti andrea.crott...@gmail.com wrote: What is the right pattern to split many tasks to many different workers, but where each task can only be taken once?? Push/Pull, req/rep, or something with dealer router

Re: [zeromq-dev] installing on red hat 5.3

2012-08-09 Thread andrea crotti
I installed a virtual Centos 5.8 and trying to compile it fails again because autoconf is too old, now I started an yum update and let's see if it works.. But if it doesn't it seems a bit too strict to me that there is no way to compile zmq 2.2 even on Centos 5.8, isn't it? Did anyone actually

[zeromq-dev] fire up new subscribers

2012-08-08 Thread andrea crotti
Suppose I have a publisher/subscriber model where the subscribers are many and can potentially run forever. I also want to be able to restart them though (or start new ones), but how do I know how many are actually alive in moment X? Given a publisher socket, is there a way to know how many

Re: [zeromq-dev] fire up new subscribers

2012-08-08 Thread andrea crotti
2012/8/8 Pieter Hintjens p...@imatix.com: A PUB socket doesn't tell the app how many SUB sockets are connected. You can do this using an XPUB socket and then each subscription set or cleared on the SUB socket will appear on the XPUB socket. This is (though I've not tried it) one way to know

[zeromq-dev] installing on red hat 5.3

2012-08-08 Thread andrea crotti
I tried to install libzmq (both 3.2 and 2.2) on Red Hat 5.3, and it fails to build because the autoconf version is too old. I could still try to install locally a newer copy of the autotools, but is then going to work or is just not compatible? Aren't there binary packages somewhere?

Re: [zeromq-dev] fire up new subscribers

2012-08-08 Thread andrea crotti
2012/8/8 Pieter Hintjens p...@imatix.com: On Wed, Aug 8, 2012 at 8:44 PM, andrea crotti andrea.crott...@gmail.com wrote: Nice thanks, XPUB is not mentioned in the guide though, only http://www.zeromq.org/whitepapers:0mq-3-0-pubsub It's in the API reference manual: http://api.zeromq.org/3-2

Re: [zeromq-dev] installing on red hat 5.3

2012-08-08 Thread andrea crotti
2012/8/8 Justin Cook jhc...@gmail.com: If it fails to build you are not installing it, but trying to build from source? If so, try the latest RHEL5. 5.3 is quite old. -- Justin Cook On Wednesday, 8 August 2012 at 14:04, andrea crotti wrote: I tried to install libzmq (both 3.2 and 2.2

Re: [zeromq-dev] installing on red hat 5.3

2012-08-08 Thread andrea crotti
2012/8/8 Justin Cook jhc...@gmail.com: Minor RHEL releases of the same major are API/ABI compatible, so there is no reason staying with RHEL 5.3. Further, if you need Red Hat support, they will tell you to use the latest minor release of the major in order to avoid wasting time on already

Re: [zeromq-dev] installing on red hat 5.3

2012-08-08 Thread andrea crotti
Ok I can try that, actually so far I installed the new autoconf from source and tried the compilation again, ./configure works fine but then make fails badly, I gess some commands missing maybe.. ../libtool: line 869: X--tag=CXX: command not found ../libtool: line 902: libtool: ignoring unknown

Re: [zeromq-dev] zeromq is asynchronous?

2012-08-07 Thread andrea crotti
Actually I'm very happy to see that this works exactly as expected, I can communicate with a process asking querying the status, still open for other suggestions.. __metaclass__ = type import sys import zmq from time import sleep PORT = 'tcp://*:5554' from threading import Thread class

[zeromq-dev] default language examples?

2012-08-07 Thread andrea crotti
Reading through the guide (which is great by the way) I wonder if using C as the default language is the best possible chioce.. I mean specially in the simple examples ~30% of the code is just C specific memory management and other things that are not needed in all the other bindings. I think is

Re: [zeromq-dev] default language examples?

2012-08-07 Thread andrea crotti
2012/8/7 Pieter Hintjens p...@imatix.com: On Tue, Aug 7, 2012 at 7:55 PM, andrea crotti andrea.crott...@gmail.com wrote: Reading through the guide (which is great by the way) I wonder if using C as the default language is the best possible chioce.. I mean specially in the simple examples

Re: [zeromq-dev] Designing a new architecture

2012-08-07 Thread andrea crotti
2012/8/3 andrea crotti andrea.crott...@gmail.com: So far I haven't found much more in the InteractiveClass to help me putting zeromq and cliff together actually: class cliff.interactive.InteractiveApp(parent_app, command_manager, stdin, stdout) it still takes a stdin and stdout objects

Re: [zeromq-dev] Designing a new architecture

2012-08-07 Thread andrea crotti
So now I tried the following, the smart process runs a subprocess in background, the samplecmd should send the LIST query, but it just hangs there, and I don't get any answer.. Is there anything missing (can't find anything there)? import zmq import cmd2 as cmd from multiprocessing import

Re: [zeromq-dev] zeromq is asynchronous?

2012-08-05 Thread andrea crotti
Very good thanks now is more clear.. Anyway suppose a simple example of a long running process, which can be simplified as class Proc: def __init__(self): self.status = 0 def run(self): while True: self.status += 1 sleep(2) Now suppose I want to

[zeromq-dev] zeromq is asynchronous?

2012-08-04 Thread andrea crotti
I was wondering the following thing, why is zeromq supposed to be asynchronous? For example when I do socket.send or socket.recv isn't my application actually blocking? The asynchronous that I think about is setting a callback when an event happens.. Which leads me to the next question, suppose

Re: [zeromq-dev] Designing a new architecture

2012-08-03 Thread andrea crotti
2012/8/2 Michel Pelletier pelletier.mic...@gmail.com: I would avoid stretching the file abstraction over a zmq socket like that. Maybe another library that is more flexible for command line and simple interpreters like cliff (http://pypi.python.org/pypi/cliff/) would be easier for you to

[zeromq-dev] Designing a new architecture

2012-08-02 Thread andrea crotti
I have to restructure a complex application and I would like to do this with zeromq, I'm reading the doc and trying out things but I'm a bit lost now, so some hints might be very useful.. The application I'm writing is very parallel, there are many long-running processes that do things, managed