Skip to main content

Task Dispatcher

build status coverage

Version:

1.4.5

Status:

Production/Stable

Author:

José Antonio Perdiguero López

Library that provides a system to generate tasks producers and consumers with ease.

Celery is used as backend, so it’s necessary to configure it in the application where this library will be used.

To achieve a producer-consumer behavior this library provides an easy to use script for running all necessary processes:

  • Producer: Tasks in charge of generating processing units.

  • Consumer: Tasks that handle and run processing units.

  • Scheduler: Manager that runs producer tasks according to specified dates or regularity.

Quick start

  1. Install this package using pip:

pip install task-dispatcher
  1. Decorate your functions as producer and consumer tasks:

from task_dispatcher import consumer, producer


@consumer
def square(x):
    return x**2


@producer
def prod_function(n):
    for i in range(n):
        square.delay(i)
  1. Run producer, consumer and scheduler processes:

python task-dispatcher producer
python task-dispatcher consumer
python task-dispatcher scheduler

Consumer and Producer

This library provides convenient decorators for generating a task dispatcher system based on producer-consumer pattern. Decorated functions or methods acts as Celery tasks and can be called using his own syntax: Calling celery tasks. Also, it’s possible to compose these tasks using Celery Canvas.

Register

Consumer and producer tasks are registered to ease the way of access them. There is a register module that contains the task register where all tasks can be found:

from task_dispatcher import register

# Get consumers
register.consumers

# Get produces
register.producers

Also, this register provides a set of utilities, such as convert it into JSON or YAML format:

from task_dispatcher import register

yaml_register = register.to_yaml()
json_register = register.to_json()

Command Line Interface

There is a script that can be called directly through executing the task_dispatcher package itself or the command located in commands module. To show command help:

python task-dispatcher -h

This script also gives a friendly way of list all tasks registered:

python task-dispatcher list

Django

This library can be imported and used as a Django application instead of a plain library, so that the CLI script also acts as a Django command.

Settings

Celery settings can be specified through TASK_DISPATCHER_SETTINGS variable using path format indicated in Celery application configuration.

Metadata

Release files for task-dispatcher 1.4.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for task-dispatcher 1.4.5
File Size Uploaded Provenance
task-dispatcher-1.4.5.tar.gz 9.4 kB Without provenance Details

Built distribution (wheel)

Table of built distributions (wheels) for task-dispatcher 1.4.5
File Interpreter ABI Platform
task_dispatcher-1.4.5-py2.py3-none-any.whl Python 3, Python 2 none any Details

Total release size: 23.1 kB

Release files / task-dispatcher-1.4.5.tar.gz

Download URL task-dispatcher-1.4.5.tar.gz
Size 9.4 kB
Tags Source
SHA-256 checksum
How to use checksums
b75fc42ec31b7e34e0bb3e4789f42366fa84b63a207bfbfc03262e1ef1a07f0a
BLAKE2b-256 checksum
How to use checksums
233ac7f7115b41c3534a441d0fb16c9c358f3a8f3c1c04a1475863df1c573040
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / task_dispatcher-1.4.5-py2.py3-none-any.whl

Download URL task_dispatcher-1.4.5-py2.py3-none-any.whl
Size 13.7 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
8433df599095e8413eaf77d8cc30b54e734aee5735b7b0e655a66c20bd72eb39
BLAKE2b-256 checksum
How to use checksums
ee5a7f9464c475b7e2784545096f9f58fd15fb3e3ee9817667f40c60b6d07bf4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Security for task-dispatcher 1.4.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page