django-shadow-tasks

Run tasks in background workers


License
MIT
Install
pip install django-shadow-tasks==0.0.6

Documentation

Django shadow tasks is simple lightweight library for running functions as tasks in background.

pip install django-shadow-tasks

Add shadow_tasks to INSTALLED_APPS

from shadow_tasks.publishing import shadow_task


@shadow_task
def add(a, b):
    c = a + b
    logger.info(f'{a} + {b} = {c}')

Run task in background

add.delay()

Run background worker to execute tasks from "default" queue. Shutdown after 10 tasks

shadow-tasks-consumer default 10