Skip to main content

A python work server written in C

Project description


A simple clustered python 3.5+ asyncio based work server that uses the MrQ interface.


import asyncio
import mrworkserver

async def callback(msgs):
  for m in msgs:

ws = mrworkserver.WorkServer()
ws.cb = callback

Example client

# pip install asyncmrq mrjson

import asyncio
from mrq.client import Client
import mrjson

async def run(loop):
  c = Client()
  await c.connect(io_loop=loop,servers=[("",7100)])

  msg = mrjson.dumpb([1,2,3,4,5,6,7,8,9,10])
  for x in range(10):
    await c.push( 0, 0, msg, len(msg) )

  await asyncio.sleep(1)
  await c.close()

if __name__ == '__main__':
  loop = asyncio.get_event_loop()

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

mrworkserver-0.11.tar.gz (19.2 kB view hashes)

Uploaded source

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page