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

Set Task Shadow Names as the Primary Task Name #469

Open
wants to merge 6 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion django_celery_results/backends/database.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,12 +88,14 @@ def _get_extended_properties(self, request, traceback):
_, _, task_kwargs = self.encode_content(task_kwargs)

periodic_task_name = getattr(request, 'periodic_task_name', None)
shadow_task_name = getattr(request, 'shadow', None)
task_name = shadow_task_name or getattr(request, 'task', None)

extended_props.update({
'periodic_task_name': periodic_task_name,
'task_args': task_args,
'task_kwargs': task_kwargs,
'task_name': getattr(request, 'task', None),
'task_name': task_name,
'traceback': traceback,
'worker': getattr(request, 'hostname', None),
})
Expand Down
4 changes: 4 additions & 0 deletions t/unit/backends/test_database.py
Original file line number Diff line number Diff line change
Expand Up @@ -784,6 +784,7 @@ def test_on_chord_part_return(self):
request.id = subtasks[0].id
request.group = gid
request.task = "my_task"
request.shadow = None
request.args = ["a", 1, "password"]
request.kwargs = {"c": 3, "d": "e", "password": "password"}
request.argsrepr = "argsrepr"
Expand Down Expand Up @@ -834,6 +835,7 @@ def test_callback_failure(self):
request.id = subtasks[0].id
request.group = gid
request.task = "my_task"
request.shadow = None
request.args = ["a", 1, "password"]
request.kwargs = {"c": 3, "d": "e", "password": "password"}
request.argsrepr = "argsrepr"
Expand Down Expand Up @@ -880,6 +882,7 @@ def test_on_chord_part_return_failure(self):
request.id = tid1
request.group = gid
request.task = "my_task"
request.shadow = None
request.args = ["a", 1, "password"]
request.kwargs = {"c": 3, "d": "e", "password": "password"}
request.argsrepr = "argsrepr"
Expand Down Expand Up @@ -1013,6 +1016,7 @@ def test_on_chord_part_return_multiple_databases(self):
request.id = subtasks[0].id
request.group = gid
request.task = "my_task"
request.shadow = None
request.args = ["a", 1, "password"]
request.kwargs = {"c": 3, "d": "e", "password": "password"}
request.argsrepr = "argsrepr"
Expand Down