Recall & Review
beginner
What is Celery Beat in the context of Celery?
Celery Beat is a scheduler that kicks off tasks at regular intervals, which are then executed by Celery workers. It helps automate periodic tasks like sending emails or cleaning databases.
Click to reveal answer
intermediate
How do you define a periodic task using Celery Beat in Flask?
You define periodic tasks by adding a schedule to Celery Beat's configuration, usually in the 'beat_schedule' dictionary, specifying the task name, the function to call, and the interval or crontab timing.
Click to reveal answer
beginner
What is the role of the 'beat_schedule' setting in Celery Beat?
'beat_schedule' is a dictionary where each key is a task name and the value defines when and how often the task runs, using intervals or crontab expressions.
Click to reveal answer
beginner
Why do you need to run both Celery worker and Celery Beat for periodic tasks?
Celery Beat only schedules tasks but does not execute them. The Celery worker listens for tasks and runs them. Both must run simultaneously for periodic tasks to work.
Click to reveal answer
beginner
How can you test if your periodic task with Celery Beat is working correctly?
You can check the Celery worker logs to see if the task runs at the scheduled times, or add print/log statements inside the task function to confirm execution.
Click to reveal answer
What does Celery Beat do in a Flask app?
✗ Incorrect
Celery Beat schedules tasks to run at set intervals but does not execute them.
Which configuration dictionary holds periodic task schedules in Celery Beat?
✗ Incorrect
'beat_schedule' defines when periodic tasks run.
To run periodic tasks, you must start:
✗ Incorrect
Celery Beat schedules tasks; Celery worker executes them.
Which of these can you use to specify task timing in Celery Beat?
✗ Incorrect
Crontab expressions define schedules like 'every day at 5pm'.
How can you confirm a periodic task ran successfully?
✗ Incorrect
Logs show when tasks are executed by the worker.
Explain how Celery Beat and Celery worker work together to run periodic tasks in a Flask app.
Think about who plans the task and who actually does it.
You got /4 concepts.
Describe how to set up a simple periodic task using Celery Beat in Flask.
Start from writing the task to running the scheduler and worker.
You got /4 concepts.