Skip to main content

Celery SmartBase

celery-smartbase is an extension and improvement of the popular celery PyPI package. It provides features to avoid duplicates for tasks that are pending or running and to see the "pending" tasks as well in the "jobs" Django model when you integrate Celery with Django. Although this package is improved to work with Django, users can modify the features slightly to make it work with any Python framework, not just Django.

Table of Contents

  1. Celery SmartBase
  2. Features
  3. SmartBase Class
  4. Requirements
  5. Installation
  6. Usage
  7. Contributing
  8. License
  9. Acknowledgments

Features

  1. Avoid Duplicate Tasks: Prevents the creation of duplicate tasks that are either pending or running.
  2. View Pending Tasks: Allows you to see the "pending" tasks in the "jobs" Django model when you integrate Celery with Django.

These features are developed inside an extension of the BaseTask class of the existing Celery Python package. The extension class is called SmartBase.

SmartBase Class

The SmartBase class is an extension of the BaseTask class from the Celery package. Here is the code for the SmartBase class:

class SmartBase(BaseTask):
...

[Include the full code of the SmartBase class here]

Requirements

  • Django
  • djangorestframework
  • django-model-utils
  • django-celery-results
  • django-celery-beat
  • kombu
  • celery

Installation

To install the celery-smartbase package, run the following command:

pip install celery-smartbase

Usage

To use the celery-smartbase package, you need to follow these steps:

  1. Install the celery-smartbase package using pip.

  2. In your Django project, create a tasks.py file inside your app directory.

  3. In the tasks.py file, import the SmartBase class from the celery_smartbase package and define your tasks using the SmartBase class.

Here is an example of a tasks.py file:

from celery import shared_task
from celery_smartbase import SmartBase

@shared_task(base=SmartBase, name='add')
def add(x, y):
    return x + y

In this example, the add task is defined using the @shared_task decorator with SmartBase as the base class.

  1. Start the Celery worker to process the tasks.
celery -A myproject worker --loglevel=info

Replace myproject with the name of your Django project.

Contributing

If you would like to contribute to the celery-smartbase package, please...

[Include information on how others can contribute to your package]

License

The celery-smartbase package is licensed under the...

[Include information about the license of your package]

Acknowledgments

[Include any acknowledgments or credits you would like to include]

Metadata

Release files for celery-smartbase 0.3.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 celery-smartbase 0.3.5
File Size Uploaded
celery-smartbase-0.3.5.tar.gz 4.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for celery-smartbase 0.3.5
File Interpreter ABI Platform
celery_smartbase-0.3.5-py3-none-any.whl Python 3 none any Details

Total release size: 9.9 kB

Release files / celery-smartbase-0.3.5.tar.gz

Download URL celery-smartbase-0.3.5.tar.gz
Size 4.8 kB
Tags Source
SHA-256 checksum
How to use checksums
5eee3eee36573275cce36e5d11dc1447b2d08cc6e580fe3a0ce0f82373c1192a
BLAKE2b-256 checksum
How to use checksums
478ea056879b866d83b35c0330642ae2fa255aefdf99f6f94b583f3089615ce2
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Release files / celery_smartbase-0.3.5-py3-none-any.whl

Download URL celery_smartbase-0.3.5-py3-none-any.whl
Size 5.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e91198d10c8f41d20faca2ebb4c68a3d8c51737f84123a91ffdb3e1c53e8e498
BLAKE2b-256 checksum
How to use checksums
81886925b14f19d402cb08afe0c66678b43fb8bbefd3e24f64ec30d0f9b607a7
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.17

Release history Release notifications | RSS feed

This release

0.3.5 This release

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.1

2 release files

0.3

1 release file

0.2

1 release file

0.1

1 release file

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