Skip to main content

A small wrapper around arq

Project description


Lint & test

A small wrapper around arq

Quick start

# some_project/
import asyncio
import darq

darq = darq.Darq({'redis_settings': darq.RedisSettings(host='redis')})

async def add_to_42(ctx, a: int) -> int:
    return 42 + a

async def main():
    # Before adding tasks to queue we should connect darq instance to redis
    await darq.connect()

    # Celery-like add task to queue:
    await add_to_42.delay(a=5)

    await darq.disconnect()

if __name__ == '__main__':

And start worker:

python3 -m darq.cli some_project.darq_app.darq

Worker output:

15:24:42: Starting worker for 1 functions: some_project.darq_app.add_to_42
15:24:42: redis_version=5.0.7 mem_usage=834.87K clients_connected=1 db_keys=2
15:25:08:   0.22s → 1315f27608e9408392bf5d3310bca38c:darq_app.add_to_42(a=5)
15:25:08:   0.00s ← 1315f27608e9408392bf5d3310bca38c:darq_app.add_to_42 ● 47

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 darq, version 0.0.2
Filename, size File type Python version Upload date Hashes
Filename, size darq-0.0.2-py3-none-any.whl (7.1 kB) File type Wheel Python version py3 Upload date Hashes View
Filename, size darq-0.0.2.tar.gz (5.0 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