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

feat: add periodic_task_name in favor of celery/django-celery-results#261 #477

Merged
merged 3 commits into from
Dec 17, 2021
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
9 changes: 5 additions & 4 deletions django_celery_beat/admin.py
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,8 @@ def run_tasks(self, request, queryset):
tasks = [(self.celery_app.tasks.get(task.task),
loads(task.args),
loads(task.kwargs),
task.queue)
task.queue,
task.name)
for task in queryset]

if any(t[0] is None for t in tasks):
Expand All @@ -219,10 +220,10 @@ def run_tasks(self, request, queryset):
)
return

task_ids = [task.apply_async(args=args, kwargs=kwargs, queue=queue)
task_ids = [task.apply_async(args=args, kwargs=kwargs, queue=queue, periodic_task_name=periodic_task_name)
if queue and len(queue)
else task.apply_async(args=args, kwargs=kwargs)
for task, args, kwargs, queue in tasks]
else task.apply_async(args=args, kwargs=kwargs, periodic_task_name=periodic_task_name)
for task, args, kwargs, queue, periodic_task_name in tasks]
tasks_run = len(task_ids)
self.message_user(
request,
Expand Down
1 change: 1 addition & 0 deletions django_celery_beat/schedulers.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,7 @@ def __init__(self, model, app=None):
self.options['expires'] = getattr(model, 'expires_')

self.options['headers'] = loads(model.headers or '{}')
self.options['periodic_task_name'] = model.name
lvelvee marked this conversation as resolved.
Show resolved Hide resolved

self.total_run_count = model.total_run_count
self.model = model
Expand Down