Skip to content

Add support for stamps #481

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

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open

Conversation

freddyheppell
Copy link

Fixes #480

Adds support for stamping by copying stamps into the result meta. This is the same approach Celery's base backend takes.

I wrote a test but it's currently marked as skipped, as I couldn't figure out how to set the stamps on the request. You can't set them directly on the Request object and I wasn't sure if I could pass something into the _create_request helper to set them.

@auvipy auvipy requested review from auvipy and Copilot June 9, 2025 15:54
Copy link

@Copilot Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR adds support for stamping by copying stamp values into the task result meta, following the approach used by Celery's base backend.

  • Adds a new skipped unit test to verify stamping support.
  • Updates the DatabaseBackend's meta extraction function to incorporate stamps and stamped headers into the task metadata.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
t/unit/backends/test_database.py Adds a unit test for stamping support (currently skipped).
django_celery_results/backends/database.py Updates metadata extraction to incorporate stamping data.
Comments suppressed due to low confidence (1)

t/unit/backends/test_database.py:553

  • The test for stamped headers is currently skipped. Consider investigating an approach to inject stamped headers into the request so that stamping support is actively validated.
@pytest.mark.skip("Need to find how to inject stamped headers")

@@ -550,6 +550,37 @@ def test_backend__task_result_meta_injection(self):
tr = TaskResult.objects.get(task_id=tid2)
assert json.loads(tr.meta) == {'key': 'value', 'children': []}

@pytest.mark.skip("Need to find how to inject stamped headers")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

mmmm.... not sure if we should merge this with this test only.... should we wait bit more?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah I agree this needs testing - I just couldn't work out how to actually go about setting the stamp on the request

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

Successfully merging this pull request may close these issues.

Stamps not supported in database backend
2 participants