I am quite new to Celery. Here is my code for configuring Celery Beat.
app.conf.beat_schedule = {
# EMAILS
'send-feedback-mail-every-2-weeks': {
'task': 'stocks.tasks.send_ask_feedback',
'schedule': crontab(day_of_week=6),
},
'get-terminal-data-frequently': {
'task': 'stocks.tasks.get_terminal_data_func',
'schedule': crontab(minute="*"),
},
# NEWS
'get-newyorktimes-api': {
'task': 'stocks.tasks.get_news_nyt',
'schedule': crontab(minute="*"),
},
}
I am wondering how to query the associated tasks for the periodic task get-newyorktimes-api
in my view to pass the result of each into the context. I tried:
context['celery'] = TaskResult.objects.filter(periodic_task_name='get-newyorktimes-api')
It returned an empty queryset even though I've run the task successfully multiple times. Where is my fault in this Task filter?