how to see the celery messages in redis?

Viewed 321

I have a celery worker running redis as a broker. Starting the worker processes gives me this:

 celery -A celeryworker worker --loglevel=INFO
 
 -------------- celery@cd38f5e26c28 v5.2.1 (dawn-chorus)
--- ***** ----- 
-- ******* ---- Linux-5.10.25-linuxkit-x86_64-with-glibc2.28 2021-12-14 00:22:02
- *** --- * --- 
- ** ---------- [config]
- ** ---------- .> app:         myapp:0x7f96dd51af10
- ** ---------- .> transport:   redis://redis-container:6379/1
- ** ---------- .> results:     disabled://
- *** --- * --- .> concurrency: 6 (prefork)
-- ******* ---- .> task events: OFF (enable -E to monitor tasks in this worker)
--- ***** ----- 
 -------------- [queues]
                .> 0                exchange=0(direct) key=0
                

[tasks]
  . app.tasks.bye
  . app.tasks.printme

[2021-12-14 00:22:02,708: INFO/MainProcess] Connected to redis://redis-container:6379/1
[2021-12-14 00:22:02,717: INFO/MainProcess] mingle: searching for neighbors
[2021-12-14 00:22:03,740: INFO/MainProcess] mingle: all alone


[2021-12-14 00:22:03,762: INFO/MainProcess] celery@cd38f5e26c28 ready.
[2021-12-14 00:22:23,332: INFO/MainProcess] Task app.task.bye[7e28e6a0-8aaa-4609-bd85-9312e91cb355] received
[2021-12-14 00:23:23,326: INFO/ForkPoolWorker-3] Task app.tasks.bye[7e28e6a0-8aaa-4609-bd85-9312e91cb355] succeeded in 60.061842500006605s: 'the text was byebye!!'

This is what I can see in redis right after starting the celery workers:

127.0.0.1:6379[1]> keys *
1) "_kombu.binding.0"
2) "_kombu.binding.celery.pidbox"
3) "_kombu.binding.celeryev"

Even if I set a long timer on my tasks (sleep(60)) the tasks will take 60 seconds to run, but I still don't see anything in my redis container. mget <key> returns nil for all keys above.

I was expecting to see messages incoming in form of ID or something into Redis (I can see messages if I use SQS as broker, but not for redis).

1 Answers

Your messages are picked immediately by your worker. To actually see where redis stores them, stop your worker process and then publish it (You can execute task.delay(*args, **kwargs) from python shell).

You'll find your messages under celery key in your redis. Celery Keys in redis

Note: Check your redis broker url and which logical database it is using

Related