Challenge - 5 Problems
Celery Beat Mastery
Get all challenges correct to earn this badge!
Test your skills under time pressure!
❓ component_behavior
intermediate1:30remaining
What happens when a periodic task is scheduled with Celery Beat?
Consider a Django project using Celery and Celery Beat. If you schedule a periodic task to run every 10 minutes, what will Celery Beat do?
Attempts:
2 left
💡 Hint
Think about how Celery Beat interacts with Celery workers to run tasks.
✗ Incorrect
Celery Beat acts as a scheduler. It sends messages to Celery workers at the scheduled times to run the tasks. It does not run tasks itself.
📝 Syntax
intermediate1:30remaining
Which Celery Beat schedule syntax correctly runs a task every hour?
Given the following Celery Beat schedule snippet, which option correctly schedules a task to run every hour?
Django
from celery.schedules import crontab CELERY_BEAT_SCHEDULE = { 'task-every-hour': { 'task': 'myapp.tasks.my_task', 'schedule': ??? } }
Attempts:
2 left
💡 Hint
An hourly task runs at minute 0 of every hour.
✗ Incorrect
Using crontab(minute=0, hour='*') schedules the task to run at the start of every hour.
🔧 Debug
advanced2:00remaining
Why does a periodic task not run even though Celery Beat is running?
You have Celery Beat running and a periodic task scheduled. However, the task never executes. Which of the following is the most likely cause?
Attempts:
2 left
💡 Hint
Celery Beat only sends messages; workers must be ready to receive them.
✗ Incorrect
If the Celery worker is not running or cannot connect to the broker, tasks will not execute even if Celery Beat schedules them.
❓ state_output
advanced1:30remaining
What is the state of a periodic task after Celery Beat triggers it?
When Celery Beat triggers a periodic task, what is the expected state of the task in Celery's task monitoring system immediately after triggering?
Attempts:
2 left
💡 Hint
Think about when the task actually starts running.
✗ Incorrect
After Celery Beat sends the task message, the task is 'PENDING' until a worker receives and starts it.
🧠 Conceptual
expert2:30remaining
How does Celery Beat ensure periodic tasks run on schedule in a distributed system?
In a distributed Django application with multiple Celery Beat instances running for redundancy, how does Celery Beat prevent the same periodic task from running multiple times simultaneously?
Attempts:
2 left
💡 Hint
Think about how distributed systems avoid duplicate work.
✗ Incorrect
Celery Beat uses distributed locking mechanisms (like locks in Redis or the database) to ensure only one scheduler instance sends task messages at a time.