Skip to main content

A python work server written in C

Project description

MrWorkServer

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

Example

import asyncio
import mrworkserver

async def callback(msgs):
  print("Callback:")
  for m in msgs:
    print(m)

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

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=[("127.0.0.1",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()
  loop.run_until_complete(run(loop))
  loop.close()

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.7.tar.gz (18.0 kB view details)

Uploaded Source

File details

Details for the file mrworkserver-0.7.tar.gz.

File metadata

  • Download URL: mrworkserver-0.7.tar.gz
  • Upload date:
  • Size: 18.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.19.1 setuptools/40.4.3 requests-toolbelt/0.8.0 tqdm/4.26.0 CPython/3.7.0

File hashes

Hashes for mrworkserver-0.7.tar.gz
Algorithm Hash digest
SHA256 074736ff65e90da1023b5d2594f768b0c823139a2499e3af3e0745eb5fdbf1ed
MD5 2a09bf350594d95d40ec3f8e837807d6
BLAKE2b-256 4ed8a69ed1d8afb55557e9608462bc20aaad5e11f505fb3e18c058d62196556c

See more details on using hashes here.

Provenance

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