Accessing Periodic Task ID inside when the task is executing #530
Unanswered
Shivendra2407
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Hello folks,
I am working for the first time with celery and scheduling tasks. I came across django-celery-beat via online search and explorations. Currently I have a setup where I create a Periodic Task object and link a registered task with it. Then that task executes at its scheduled interval or scheduled cron.
In my tasks.py file I have:
@shared_task(name="notify")
def send_notification(*args, **kwargs):
print('Hello World')
I have a model ScheduledNotifications that has a foreign key to Periodic Tasks model of django-celery-beat.
Ask:
I am struggling to acquire the periodic-task id when the send_notification() method gets executed at its schedule. I wan to access that periodic task id so i can query the ScheduledNotifications model and get the data stored in the notification object and use it probably to trigger a firebase devices notification or some other background activity.
Any suggestions?
Beta Was this translation helpful? Give feedback.
All reactions