Skip to main content

percival

The client half of Percival, a self-hosted control panel for Celery. You install it in your Celery project. It lets the panel change schedules without restarting beat or workers, and it stops two things a ping monitor can't see: a task running twice, and a stale worker running old code.

Needs Celery 5.3+ and Redis. The broker can be Redis or RabbitMQ.

Setup

pip install percival
# proj/celery.py, right after app = Celery(...)
import os, percival

percival.init(
    app,
    redis_url="redis://localhost:6379/0",
    code_version=os.environ.get("GIT_SHA", "dev"),  # whatever identifies a deploy
)
celery -A proj beat -S percival.beat.Scheduler

Then run the panel, one container:

docker run -d -p 8080:8080 -v percival:/data \
  -e PERCIVAL_REDIS_URL=redis://host.docker.internal:6379/0 \
  -e PERCIVAL_ADMIN_PASSWORD=pick-a-long-one \
  ghcr.io/rijinraju/percival

Or install it with pip install percival-server.

What init() sets up

  • Run events. Started, success, failure, retry and revoked go to a Redis stream, with timing, worker, code version and redacted args. Anything named like password, token or secret is replaced before it leaves the worker.
  • Worker heartbeat. Every worker reports its hostname, queues and code version every 30 seconds.
  • Task metadata. The signature, docstring and source of each task, so the panel can show them. Pass publish_source=False to keep source private.
  • Stale worker gate. A schedule can require a code version. A worker on a different version doesn't run the task. The message goes back on the queue for an up-to-date worker.

Stopping duplicate runs

from percival import once_per


@app.task
@once_per(key=lambda user_id, **kw: user_id, window="1d")
def send_digest(user_id): ...

A second run for the same key in the same window is skipped and recorded.

Moving an existing beat_schedule

percival import --app proj.celery:app --redis-url redis://localhost:6379/0 --apply

Then remove those entries from beat_schedule.

The full README has every option and a docker compose up demo.

Metadata

Release files for percival 0.1.1

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

Source distribution (sdist)

Source distribution for percival 0.1.1
File Size Uploaded Provenance Actions
percival-0.1.1.tar.gz 26.7 kB Without provenance Details for percival-0.1.1.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for percival 0.1.1
File Interpreter ABI Platform Actions
percival-0.1.1-py3-none-any.whl Python 3 none any Details for percival-0.1.1-py3-none-any.whl

Total release size: 53.5 kB

Release files / percival-0.1.1.tar.gz

Download URL percival-0.1.1.tar.gz
Size 26.7 kB
Tags Source
SHA-256 checksum
How to use checksums
141a85f6c826db9601baeeb58303149bd3f659c9d8d8624bd4d4f8b90d0bf0f8
BLAKE2b-256 checksum
How to use checksums
65193d3f934e93270568cf8cc474c13a436b2460dc135628c962cae4432cfd7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Release files / percival-0.1.1-py3-none-any.whl

Download URL percival-0.1.1-py3-none-any.whl
Size 26.8 kB
Tags Python 3
SHA-256 checksum
How to use checksums
4bc4f9405196c3eda4550ae5d574d0cf0d9e50446b720e4bd1a9a4cf3b2f365e
BLAKE2b-256 checksum
How to use checksums
3b4a33d659ebbbd25e5a70fd23b64f22061de2280333473caed1252063634c60
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/7.0.0 CPython/3.12.3

Security for percival 0.1.1

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.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

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