Skip to main content

Python async worker

Project description


A Python worker running over asyncio

Build Status python version License codecov


python 3.8+


pip install aioworker


import asyncio

from aioworker import Service, Worker

async def task_1(loop):
    while True:
        print('Hello world')
        await asyncio.sleep(2)

if __name__ == '__main__':
    #  Run the server using 1 worker processes.

or run tasks and the webserver

import asyncio

from aioworker import Service, Worker

async def sleeping(loop):
    while True:
        print('Sleeping for 2 seconds...')
        await asyncio.sleep(2)

async def on_client_connect(reader, writer):
    Read up tp 300 bytes of TCP. This could be parsed usign the HTTP protocol for example
    data = await
    print(f'TCP Server data received: {data} \n')
    await writer.drain()

if __name__ == '__main__':
    # Run the server using 1 worker processes.
            'client_connected_cb': on_client_connect,

How to stop the worker


Default values

Variable Default
TCP server host
TPC server port 8888


  1. Hello world
  2. TCP Server
  3. Kafka Consumer


  1. Clone this repo
  2. Run poetry install
  3. Test using ./scripts/test
  4. Lint automatically using ./scripts/lint

Project details

Download files

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

Files for aioworker, version 0.2.0
Filename, size File type Python version Upload date Hashes
Filename, size aioworker-0.2.0-py3-none-any.whl (4.4 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size aioworker-0.2.0.tar.gz (4.5 kB) File type Source Python version None Upload date Hashes View

Supported by

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