Skip to main content

Django Tasks backend combining in-process thread pool execution with database persistence

Project description

django-tasks-local-db

A Django Tasks backend that combines in-process thread pool execution with database persistence. Tasks run in your web process without a separate worker, while results are durably stored in the database.

This project is a remix of django-tasks-local and django-tasks-db. It takes the in-process executor approach from django-tasks-local and adds DB-backed result storage from django-tasks-db.

How it works

  • enqueue() writes a task row to the database, then submits it to an in-process thread pool
  • On completion, the DB row is updated with the result or error
  • On restart, orphaned tasks are recovered from the database and resubmitted

Installation

pip install django-tasks-local-db

Configuration

INSTALLED_APPS = [
    # ...
    "django_tasks_local_db",
]

TASKS = {
    "default": {
        "BACKEND": "django_tasks_local_db.LocalDBBackend",
        "OPTIONS": {
            "MAX_WORKERS": 4,
        },
    }
}

Then run migrations:

python manage.py migrate django_tasks_local_db

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

django_tasks_local_db-0.2.0.tar.gz (25.8 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

django_tasks_local_db-0.2.0-py3-none-any.whl (15.3 kB view details)

Uploaded Python 3

File details

Details for the file django_tasks_local_db-0.2.0.tar.gz.

File metadata

  • Download URL: django_tasks_local_db-0.2.0.tar.gz
  • Upload date:
  • Size: 25.8 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.7

File hashes

Hashes for django_tasks_local_db-0.2.0.tar.gz
Algorithm Hash digest
SHA256 26ac6f19b2e04b2205b5ec2653ee87cf2390be70129601d85998ab37e4275eea
MD5 421130cb27b59cac22e9eded0ae1cbd2
BLAKE2b-256 8ef58a3a1681fb61738f40e5525cadb34c953358ed068f56e7e5259052d49490

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_tasks_local_db-0.2.0.tar.gz:

Publisher: release.yml on fgregg/django-tasks-local-db

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file django_tasks_local_db-0.2.0-py3-none-any.whl.

File metadata

File hashes

Hashes for django_tasks_local_db-0.2.0-py3-none-any.whl
Algorithm Hash digest
SHA256 57b5a36ca21c6d1f4c5650432d9471789a6ee0b29044d9510c465ba87fc50a68
MD5 7140956d457af64dc7c1362ec14224a4
BLAKE2b-256 04902145ed42f0a3f5771961fa481d4b012b56797e3a50142d0a9f95c6f27c69

See more details on using hashes here.

Provenance

The following attestation bundles were made for django_tasks_local_db-0.2.0-py3-none-any.whl:

Publisher: release.yml on fgregg/django-tasks-local-db

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page