Skip to main content

RPC between distributed workers

Project description

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.

Example

Server-side

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

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()
worker_sock = ctx.socket(zmq.PULL)
worker_sock.bind('tcp://*:24600')

worker = zeronimo.Worker(Application(), [worker_sock])
worker.run()

Client-side

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

import zmq.green as zmq
import zeronimo

ctx = zmq.Context()

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

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

for line in customer.rycbar123():
    print line

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

zeronimo-0.1.0.tar.gz (13.3 kB view details)

Uploaded Source

File details

Details for the file zeronimo-0.1.0.tar.gz.

File metadata

  • Download URL: zeronimo-0.1.0.tar.gz
  • Upload date:
  • Size: 13.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No

File hashes

Hashes for zeronimo-0.1.0.tar.gz
Algorithm Hash digest
SHA256 07c183ce6bd120abb9eecd6f0293da57a0bccc5bbbb40458ccf4f91d9b81f8bc
MD5 9d57e001eb5756bf79f665a19792cbc4
BLAKE2b-256 1e2f06b23104e2cc9f32092ab846eaa780188f47dc003fd0effe753dde87355e

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page