-
Notifications
You must be signed in to change notification settings - Fork 215
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
base: main
Are you sure you want to change the base?
Conversation
There was a problem hiding this 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")
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@@ -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") |
There was a problem hiding this comment.
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?
There was a problem hiding this comment.
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
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.