celery-insights icon indicating copy to clipboard operation
celery-insights copied to clipboard

[BUG] arguments and results is shown with empty/Null although I am sure they have values

Open johnfawzy84 opened this issue 1 year ago • 6 comments

Describe the bug I have a configuration where redis is working as broker and results backend. I can see the tasks when I trigger/clients but I always see the Arguments and results with Empty/None in the tasks view. e.g. http://localhost:8555/tasks/ the tasks has a result and/or arguments, I can see this in the (Tasks explorer)

To Reproduce Steps to reproduce the behavior:

  1. Start a celery chain where the tasks has arguments and return vaules
  2. click from the tasks explorer on a task
  3. Scroll down to see Arguments and Results in the tasks view
  4. See that arguments is empty and results has None

Expected behavior Arguments / Kwargs will have values Results will have values

Screenshots If applicable, add screenshots to help explain your problem.

image

Additional context the result backend and the broker are both redis.

johnfawzy84 avatar Oct 11 '24 16:10 johnfawzy84

Hey, just to make sure - have you enabled result_extended=True in your Celery app? https://docs.celeryq.dev/en/stable/userguide/configuration.html#result-extended

It is recommended here in the README.md, this potentially could be added to the UI as well. https://github.com/danyi1212/celery-insights?tab=readme-ov-file#enabling-celery-events

danyi1212 avatar Oct 13 '24 15:10 danyi1212

yeah, I enabled result_extended Here is the configuration block ` app.conf.worker_send_task_events = True

app.conf.task_send_sent_event = True

app.conf.task_track_started = True

app.conf.result_extended = True `

Actually in the state.json, I can see the values correctly.

An example for the json output of state is something like : `

17  
id "1212ed51-b525-470c-9eba-f4a2453768ba"
type "Create Order for Something"
state "SUCCESS"
sent_at 1728639287.4776063
received_at 1728639287.4232242
started_at 1728639287.4248035
succeeded_at 1728639287.4776063
failed_at null
retried_at null
revoked_at null
rejected_at null
runtime 0.052537856998242205
last_updated 1728639287.4776063
args "()"
kwargs "{'order_id': UUID('ee6c13a4-4ad6-4a16-9756-665fe6baedcf')}"
eta null
expires null
retries 0
exchange null
routing_key null
root_id "06648238-457d-41e9-9f18-89398ccd82f9"
parent_id "f9d420f2-d21a-490f-94df-ea41851ba517"
children  
0 "581dd489-4dbe-4dd3-9ab6-5e140f0650ad"
worker "celery_worker@114a8d7a90e8-1"
result "UUID('fd6c114a-9120-44b3-a00a-22b8b05b127f')"
exception null
traceback null
`

johnfawzy84 avatar Oct 13 '24 16:10 johnfawzy84

Interesting, did you take that state.json from the Debug Bundle? Can you please share what is responded from the /api/tasks/{task_id}/result call in the task details from the browser's network tab?

danyi1212 avatar Oct 15 '24 09:10 danyi1212

yes, I did take the state.json out of the Debug Bundle. The output of the /api/tasks/{task_id}/result is : { "id": "d8aaba40-38af-4661-9a56-64aaf8196f62", "type": null, "state": "PENDING", "queue": null, "result": null, "traceback": null, "ignored": false, "args": [], "kwargs": {}, "retries": 0, "worker": null }

johnfawzy84 avatar Oct 15 '24 09:10 johnfawzy84

Is there a way to solve this? I have the same issue - empty args

pedrodevoto avatar Dec 04 '24 17:12 pedrodevoto

@pedrodevoto Not that I know of, I haven't got the time yet to fix that 😔

From my observation, the args are not returned from the Redis (or other Result Backend), but is available as string on the state, that you can observe in the DevTools network responses.

For more details - This endpoint have them as Pickle String (coming from Events) - https://github.com/danyi1212/celery-insights/blob/main/server/tasks/router.py#L22 This endpoint does have them (coming from Result Store) - https://github.com/danyi1212/celery-insights/blob/main/server/tasks/router.py#L34

If you can, your help in debugging it and contributing a fix will be appreciated a lot, I would love to guide you on doing that 🌟

danyi1212 avatar Dec 04 '24 18:12 danyi1212