Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add custom fields to result field of TaskResult on Failure. #443

Open
oahshtsua opened this issue Sep 24, 2024 · 0 comments
Open

Add custom fields to result field of TaskResult on Failure. #443

oahshtsua opened this issue Sep 24, 2024 · 0 comments

Comments

@oahshtsua
Copy link

I'm using Django with Celery and django-celery-results. When a task fails, django-celery-results seems to store information about the exception that caused the failure. I would like to enhance the result field of the TaskResult model when a task fails by adding custom keys alongside the default exception details which I need to include for additional bookkeeping data. How would I go about doing this?

Current Result:

{
  "exc_type": "ValueError",
  "exc_message": ["this is a custom raised exception...."],
  "exc_module": "builtins"
}

Expected Result:

{
  "exc_type": "ValueError",
  "exc_message": ["this is a custom raised exception...."],
  "exc_module": "builtins",
  "custom_field_1": "value_1",
  "custom_field_2": "value_2"
}

Environment:

django==4.2.11
celery==5.4.0
django-celery-results==2.5.1
@oahshtsua oahshtsua changed the title Add Custom Fields to result Field of TaskResult on Failure. Add custom fields to result field of TaskResult on Failure. Sep 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant