/asyncrpc

An http rpc library, providing a manager similar to the multiprocessing.Basemanager but with gevent support

Primary LanguagePythonApache License 2.0Apache-2.0

AsyncRPC

AsyncRPC is a http rpc library, providing a manager similar to the multiprocessing.Basemanager with gevent support.

  • AsyncManager allows one to get gevent asynchronous proxies to remote objects
  • The manager server(s) offer an html view over the internal state of the server (for debug purposes)
  • The manager server is WSGI based, so in the future other wsgi compatible servers can be used (for now, cherrypi and tornado are supported)

Important Notes

This software is the product of research carried out at the University of Zurich and comes with no warranty whatsoever. Have fun!

TODO's

  • The project is not documented (yet)

How to Install the Project

To install AsyncRPC you have two options: 1) manual installation (install requirements first) or 2) automatic with pip

Install the project manually from source (after downloading it locally):

$ python setup.py install

Install the project with pip:

$ pip install https://github.com/cosminbasca/asyncrpc

Also have a look at the test.sh scripts included in the codebase

Examples

For more information have a look at the tests inside asyncrpc.test

from asyncrpc.manager import AsyncManager

class FooClass(object):
    def __init__(self, init_bar=-1):
        self.bar = init_bar

    def foo(self, val):
        self.bar += val
        return self.bar

class FooManager(AsyncManager):
    pass

FooManager.register("FooClass", FooClass)

manager = FooManager(async=True)
manager.start()

my_foo = manager.FooClass(100)
# should print 100
print my_foo.foo(0)
# should print 200
print my_foo.foo(100)
# should print 200
print my_foo.foo(0)

Thanks a lot to