semvec/pypi-packages huggingface dataset:
zeronimo 0.7.2
RPC between distributed workers
License: BSD

Zeronimo
~~~~~~~~

A distributed RPC solution based on ØMQ_ and gevent_.  Follow the features:

- A worker can return, yield, raise any picklable object to the remote
  customer.
- A customer can invoke to any remote worker in the worker cluster.
- A customer can invoke to all remote workers in the worker cluster.

.. _ØMQ: http://www.zeromq.org/
.. _gevent: http://gevent.org/

Example
=======

Server-side
-----------

The address is 192.168.0.41. The worker will listen at 24600.

.. sourcecode:: python

   import zmq.green as zmq
   import zeronimo

   class Application(object):

       def rycbar123(self):
           for word in 'run, you clever boy; and remember.'.split():
               yield word

   ctx = zmq.Context()

   # make worker
   worker_sock = ctx.socket(zmq.PULL)
   worker_sock.bind('tcp://*:24600')
   worker = zeronimo.Worker(Application(), [worker_sock])

   # run worker forever
   worker.run()

Client-side
-----------

The address is 192.168.0.42. The reply collector will listen at 24601.

.. sourcecode:: python

   import zmq.green as zmq
   import zeronimo

   ctx = zmq.Context()

   # make remote result collector
   collector_sock = ctx.socket(zmq.PULL)
   collector_sock.bind('tcp://*:24601)
   collector = zeronimo.Collector(collector_sock, 'tcp://192.168.0.42:24601')

   # make customer
   customer_sock = ctx.socket(zmq.PUSH)
   customer_sock.connect('tcp://192.168.0.41:24600')
   customer = zeronimo.Customer(customer_sock, collector)

   # rpc
   remote_result = customer.emit('rycbar123')
   for line in remote_result.get():
       print line