justinfx / pyrpc Goto Github PK
View Code? Open in Web Editor NEWA simple remote procedure call module using ZeroMQ for python
License: Other
A simple remote procedure call module using ZeroMQ for python
License: Other
Version import under package init causes issues with python 3:
Traceback (most recent call last):
File "my_file.py", line 5, in
from pyRpc import PyRpc
File "env/lib/python3.6/site-packages/pyRpc/init.py", line 48, in
from _version import version
ModuleNotFoundError: No module named '_version'
Changing init.py from:
from _version import __version__
To:
from ._version import __version__
Seems to resolve the issue.
Server:
def insa_dispatch_rpc():
print(insa_c.magenta + "$insa> rpc triggered" + insa_c.white)
return "heck"
def rpc_serve():
globals.insa_rpc_server = PyRpc("insa_analytics", tcpaddr="127.0.0.1:4000")
globals.insa_rpc_server.publishService(insa_dispatch_rpc)
globals.insa_rpc_server.start()
print(insa_c.magenta + "$insa> rpc server is online" + insa_c.white)
while True:
time.sleep(.1)
def start_rpc_server():
threading.Thread(target = rpc_serve, args = ()).start()
Client:
def retrieve_general_data(request):
remote = RpcConnection("insa_analytics", tcpaddr="127.0.0.1:4000")
_result = None
_result = remote.call("insa_dispatch_rpc")
remote.close()
return HttpResponse(str(json.dumps(str(_result.result))))
retrieve_general_data is called instantly, I have tested this by returning an HttpResponse with a string. It is called instantaneously. For remote.call(...) to return, it takes around 25-35 seconds. Why is this? I tried raising workers to 32 threads.
Also, without specifying tcpaddr, it never connects to begin with. Yes, they are on the same host system.
How much concurrency support?
When you use block modules, then rpc server meet block?
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.