spiff-arena/docs/how_to_guides/deployment/redis_celery_broker.md
Kevin Burnett 584be1df6a
Diataxis docs 2 (#2206)
* kill tags

* big four

* move doc script

* move dev to explain

* move images to root because it is better

* move scrit

* script

* move out

* moved building_diagrams

* couple devops things

* docs

* move exe

* unit test

* articlers

* wip

* path

* devops

* perm

* deploy

* stuff

* everything

* broken links

* wip

---------

Co-authored-by: burnettk <burnettk@users.noreply.github.com>
2025-01-08 08:12:48 -08:00

1.3 KiB

Redis Celery Broker

SpiffWorkflow can be configured to use Celery for efficient processing. Redis can be used as both a broker and backend for Celery.

If configured in this way, there will be a queue called "celery," and you can inspect it from redis-cli like this:

redis-cli LLEN celery # how many queued entries
redis-cli LRANGE celery 0 -1 # get all queued entries. Be careful if you have a lot.

If you want to purge all entries from the queue:

poetry run celery -A src.spiffworkflow_backend.background_processing.celery_worker purge

If you want to inspect jobs that are currently being processed by workers:

poetry run celery -A src.spiffworkflow_backend.background_processing.celery_worker inspect active

When we publish a message to the queue, we log a message like this at the log level info:

Queueing process instance (3) for celery (9622ff55-9f23-4a94-b4a0-4e0a615a8d14)

If you want to get the results of this job after the worker processes it, you would run a query like this:

redis-cli get celery-task-meta-9622ff55-9f23-4a94-b4a0-4e0a615a8d14

As such, if you wanted to get ALL of the results, you could use a command like:

echo 'keys celery-task-meta-\*' | redis-cli | sed 's/^/get /' | redis-cli