Celery + Redis task queue with admin UI for monitoring and retrying failed/stuck tasks
Project description
simple_module_background_tasks
Celery + Redis background-task module for simple_module apps. Provides a pre-configured Celery instance, a task registration hook, and an admin UI for monitoring + retrying failed/stuck tasks.
Install
pip install simple_module_background_tasks
Requires a Redis broker — set SM_CELERY_BROKER_URL (default redis://localhost:6379/0).
What it provides
register_background_tasks()module hook — modules declare tasks here; the registry wires them into the Celery app at boot.- Admin UI at
/background-tasks/admin— list recent runs, retry failed, inspect tracebacks. - Shared Celery app accessible via
from background_tasks import celery_app(import namebackground_tasks, distribution namesimple_module_background_tasks).
Usage
Declare a task in a module:
# modules/reports/reports/tasks.py
from background_tasks import celery_app # type: ignore[import-not-found]
@celery_app.task(name="reports.generate")
def generate_report(report_id: int) -> None:
...
Register it:
class ReportsModule(ModuleBase):
meta = ModuleMeta(name="reports", depends_on=["background_tasks"])
def register_background_tasks(self):
from . import tasks # noqa: F401 — side-effect: registers tasks
Enqueue from an endpoint:
generate_report.delay(report_id=42)
Run a worker locally:
uv run celery -A background_tasks.celery_app worker --loglevel=info
Depends on
simple_module_core,simple_module_db,simple_module_hostingcelery[redis]>=5.4,redis>=5
License
MIT — see LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file simple_module_background_tasks-0.0.2.tar.gz.
File metadata
- Download URL: simple_module_background_tasks-0.0.2.tar.gz
- Upload date:
- Size: 27.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
6e2831840f017c3aa1fc648cca0775be3485e880a43e2620ee631471ea137655
|
|
| MD5 |
c5a56cac7db0d5b08c5ee09da4a595c1
|
|
| BLAKE2b-256 |
ae02ffacb2c779ed8d55f78ae8cc9a5bba69e74e27a71d311e19c91ff76a9b65
|
Provenance
The following attestation bundles were made for simple_module_background_tasks-0.0.2.tar.gz:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_background_tasks-0.0.2.tar.gz -
Subject digest:
6e2831840f017c3aa1fc648cca0775be3485e880a43e2620ee631471ea137655 - Sigstore transparency entry: 1391727902
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Trigger Event:
workflow_dispatch
-
Statement type:
File details
Details for the file simple_module_background_tasks-0.0.2-py3-none-any.whl.
File metadata
- Download URL: simple_module_background_tasks-0.0.2-py3-none-any.whl
- Upload date:
- Size: 34.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.12
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a6d4584cee7ce881a0524b5195a171dc536a3046289a551aeba966f0b170340f
|
|
| MD5 |
1eb8003a886d18471de0872e217fa683
|
|
| BLAKE2b-256 |
c05e840a5c3110fb8551820c596e3b3864492cc56aeff405ff8114128bb39ac4
|
Provenance
The following attestation bundles were made for simple_module_background_tasks-0.0.2-py3-none-any.whl:
Publisher:
release.yml on antosubash/simple_module_python
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
simple_module_background_tasks-0.0.2-py3-none-any.whl -
Subject digest:
a6d4584cee7ce881a0524b5195a171dc536a3046289a551aeba966f0b170340f - Sigstore transparency entry: 1391727915
- Sigstore integration time:
-
Permalink:
antosubash/simple_module_python@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Branch / Tag:
refs/heads/main - Owner: https://github.com/antosubash
-
Access:
private
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
release.yml@1a7e639ff44ab1e2ebf917e0a7f7148e947ca085 -
Trigger Event:
workflow_dispatch
-
Statement type: