Skip to main content

Celery worker for running asyncio coroutine tasks

Project description

AsyncIO Celery Worker

Overview

This project is an alternative asyncio implementation of the Celery Worker protocol.

  • Feature parity with upstream Celery project IS NOT the goal
  • Support of different brokers/result backends IS NOT the goal

The following are the actual goals:

  • The code base of this project must be as simple as possible to understand and reason about
  • There should be as little code as possible (less code means less bugs)
  • There should be as little external dependencies as possible
  • This project must not have celery as an external dependency

Usage

import asyncio
from aio_celery import Celery

app = Celery()

@app.task(name='add-two-numbers')
async def mul(a, b):
    await asyncio.sleep(5)
    return a + b

Then run worker:

$ aio_celery -A hello:app worker --concurrency=50000
$ aio_celery worker hello:app

Queue some tasks:

import asyncio
from hello import add, app

async def fill_queue():
    async with app.setup():
        for n in range(50000):
            await add.delay(n, n)

asyncio.run(fill_queue())

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

aio-celery-0.1.0.tar.gz (9.7 kB view hashes)

Uploaded Source

Built Distribution

aio_celery-0.1.0-py3-none-any.whl (11.6 kB view hashes)

Uploaded Python 3

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