zerorpc | scalable implementation RPC over ZeroMQ
kandi X-RAY | zerorpc Summary
kandi X-RAY | zerorpc Summary
A protocol (and Python implementation) for RPC over ZeroMQ which uses JSON for data serialization. The resulting Python implementation is approx 5x faster than the corresponding xmlrpcserver & client in the single-threaded case, and nearly 10x faster in the multithreaded case. It is simple to achieve over 10K RPC calls/sec with this implementation.
Support
Quality
Security
License
Reuse
Top functions reviewed by kandi - BETA
- Perform a single call
- Communicate a request
zerorpc Key Features
zerorpc Examples and Code Snippets
Community Discussions
Trending Discussions on zerorpc
QUESTION
I am developing an electron-python app and I need to install zerorpc
to share data between nodejs and python.
I first installed zeromq
to the system
ANSWER
Answered 2020-Oct-25 at 22:43Zerorpc
is outdated and last update was 2 years ago. I suppose it's incompatible with NodeJs 15. Try it with nodejs 10, 12, or 14 versions.
QUESTION
I try to build a GUI for given Python code using Electron. The data flow is actually straight-forward: The user interacts with the Electron app, which sends a request to the Python API, which processes the request and sends a reply.
So far, so good. I read different threads and blog posts:
- ZeroRPC solutions:
- https://medium.com/@abulka/electron-python-4e8c807bfa5e
- https://github.com/fyears/electron-python-example
- Spawn Python API as child process from node.js and communicate directly:
- https://www.ahmedbouchefra.com/connect-python-3-electron-nodejs-build-desktop-apps/
- This seems to be not the smartest solution for me, since using zeroRPC or zeroMQ makes it more easy to change the frontend architecture without touching the backend code.
- Use zeroMQ sockets (for example exclusive pair?)
But in all three solutions, I struggle at the same point: I have to make asynchronous requests/replies, because the request processing can take some time and in this time, there can occur already further requests. For me, this looks like a very common pattern, but I found nothing on SO, maybe I just don't know, what exactly I am looking for.
...ANSWER
Answered 2020-Jun-07 at 20:16If you're thinking of using ZeroMQ, you are entering into the world of Actor model programming. In actor model programming, sending a message happens independently of receiving that message (the two activities are asynchronous).
What ZeroMQ means by Blocking
When ZeroMQ talks about a send "blocking", what that means is that the internal buffer ZeroMQ uses to queue up messages prior to transmission is full, so it blocks the sending application until there is space available in this queue. The thing that empties the queue is the successful transfer of earlier messages to the receiver, which has a receive buffer, which has to be emptied by the recieve application. The thing that actually transfers the messages is the mamangement thread(s) that belong to the ZeroMQ contenxt.
This management thread is the cruicial part; it's running independently of your own application threads, and so it's making the communications between sender and receiver asynchronous.
What you likely want is to use ZeroMQ's reactor, zmq_poll(). Typically in actor model programming you have a loop, and at the top is a call to the reactor (zmq_poll() in this case). Zmq_poll() tells you when something has happened, but here you'd primarily be interested in it telling you that a message has arrived. Typically then you'd read that message, process it (which may involve sending out other ZeroMQ messages), and looping back to the zmq_poll().
Backend
So your backend would be something like:
QUESTION
I am working on an audio editing prototype. At the moment it is very simple, so it currently works as a Web App using JavaScript, HTML and CSS. This makes it possible to build as an Electron app, using Node.js to access the file system.
However, it makes heavy use of a Python program called Gentle, particularly the file align.py. I was wondering if it was possible to integrate this program somehow, given how frequently it is used.
I am not familiar with Python, but I have tried to work out if this can be done. I have read about child_process, python-shell and zerorpc. However, if possible, I do not want to force the user to install Python along with all the dependencies required for Gentle, as it is a difficult process with lots of room for error.
This is where I have become stuck. Ultimately I am looking for a way to use Gentle in a way which gives the appearance of it being part of the functionality as a single self-contained program, rather than butchered on with duct tape.
I realize Gentle includes the option for a REST API and a Python server, but I am more interested in using Gentle offline for faster functionality. I am also too broke to afford hosting.
I realize I am kind of working backwards, as the front-end normally comes after the back-end. If it is easier I can try to rewrite the code base in Python or a lower-level language, but I am trying to avoid this if possible.
Any help or suggestions would be greatly appreciated!
...ANSWER
Answered 2020-Jun-04 at 07:19You can compile the Python program and include the resulting binary file into your Electron app and just run the binary via child_process
. There are several ways to create executables from Python programs.
Community Discussions, Code Snippets contain sources that include Stack Exchange Network
Vulnerabilities
No vulnerabilities reported
Install zerorpc
You can use zerorpc like any standard Python library. You will need to make sure that you have a development environment consisting of a Python distribution including header files, a compiler, pip, and git installed. Make sure that your pip, setuptools, and wheel are up to date. When using pip it is generally recommended to install packages in a virtual environment to avoid changes to the system.
Support
Reuse Trending Solutions
Find, review, and download reusable Libraries, Code Snippets, Cloud APIs from over 650 million Knowledge Items
Find more librariesStay Updated
Subscribe to our newsletter for trending solutions and developer bootcamps
Share this Page