Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Missing Poller? #52

Open
zsunberg opened this issue Apr 9, 2014 · 8 comments
Open

Missing Poller? #52

zsunberg opened this issue Apr 9, 2014 · 8 comments

Comments

@zsunberg
Copy link

zsunberg commented Apr 9, 2014

Hi, I'm writing a distributed engineering app with ZMQ. Some of my components will need to read from multiple sockets. I gather from the ZMQ documentation that I will need to use a Poller for this, however I do not see this in the Julia ZMQ implementation.

I see the POLLIN and POLLOUT constants are defined, but I don't see anything else. Is this a missing feature?

@Keno
Copy link
Contributor

Keno commented Apr 9, 2014

I believe on the Julia side you should be able to just use multiple Julia tasks, one for each socket. Does that not work for your usecase?

@zsunberg
Copy link
Author

Thanks for the tip. That may work - I need to read up some more on Julia multiprocessing.

@stevengj
Copy link
Contributor

This is how IJulia works, since it also needs to read from multiple sockets.

@pearcemc
Copy link

poll still seems to be missing. I looked into the source but got as far as Base._FDWatcher and thought this was too internal to start playing with.

@malmaud
Copy link

malmaud commented Feb 28, 2017

While it's true that Julia tasks can largely accomplish the tasks that ZMQ polling are useful for, I don't see why we still couldn't a polling API like http://learning-0mq-with-pyzmq.readthedocs.io/en/latest/pyzmq/multisocket/zmqpoller.html.

@hustf
Copy link

hustf commented Jun 24, 2017

@aviks ; we briefly talked at Juliacon about this.
The asyncronous majordomo pattern is touted as a very robust solution. For stepwise building and testing of a system, it is very helpful to open an independent REPL for each of the main workers.
I have tried looking at implementations in Javascript and Python. But linking the additional c-functions in a good way is a huge and scary step for some of us.

@vtjnash
Copy link
Contributor

vtjnash commented Jun 25, 2017

As keno and stevengj mentioned above, this pattern is not recommended in Julia. Like nodejs, the simple pattern already "just works" (via Tasks) and doesn't need an additional mechanism to make it parallel (e.g. compare the simplicity of http://zguide.zeromq.org/js:mspoller vs the more complex implementation in python using poller http://zguide.zeromq.org/py:mspoller).

@hustf
Copy link

hustf commented Jun 25, 2017

I don't think that enables us to open new processes "by ourselves", e.g. on another computer, and then connect. Which is nice for control freaks or for understanding.

I was not aware of all the functionality in the ClusterManager. There's already a 'broker' implementation extending on zmq.jl so the smart approach is surely to learn to use that.

Ideally, it might perhaps be moved to this package, though. From ZMQCM.jl:

    xpub=Socket(ctx, XPUB)
    xsub=Socket(ctx, XSUB)

    ZMQ.bind(xsub, "tcp://127.0.0.1:$(BROKER_SUB_PORT)")
    ZMQ.bind(xpub, "tcp://127.0.0.1:$(BROKER_PUB_PORT)")

    ccall((:zmq_proxy, :libzmq), Cint,  (Ptr{Void}, Ptr{Void}, Ptr{Void}), xsub.data, xpub.data, C_NULL)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

8 participants