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.0

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.0
File Size Uploaded Provenance Actions
percival-0.1.0.tar.gz 26.5 kB Without provenance Details for percival-0.1.0.tar.gz

Built distribution (wheel)

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

Total release size: 53.1 kB

Release files / percival-0.1.0.tar.gz

Download URL percival-0.1.0.tar.gz
Size 26.5 kB
Tags Source
SHA-256 checksum
How to use checksums
8e941407a67b2888ff78b3577bd5d3a72452f00646a4cd717403fd6e1cc9b1aa
BLAKE2b-256 checksum
How to use checksums
eedacdb9d49daeb7847e10090ad93fcc69470dbd54f98739fb8325d85d1bba16
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.0-py3-none-any.whl

Download URL percival-0.1.0-py3-none-any.whl
Size 26.6 kB
Tags Python 3
SHA-256 checksum
How to use checksums
7f7e34d0165a505dcd42592b1d43d9b4d3ea03384b98df006c72b5ba1e3c6ea5
BLAKE2b-256 checksum
How to use checksums
7223d018be15343dcce962fdb3e8d719f5f63337d6a50f6ee4b3314b77b3ca14
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.0

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