Bird
0
0

Consider this Celery Beat schedule configuration in a Flask app:

medium📝 component behavior Q4 of 15
Flask - Background Tasks
Consider this Celery Beat schedule configuration in a Flask app:
app.config['beat_schedule'] = {
'notify': {
'task': 'notifications.send_email',
'schedule': 10
}
}

What will Celery Beat do when running with this setup?
ARun the task only once at app startup
BExecute the 'notifications.send_email' task immediately once
CIgnore the task because 'schedule' must be a crontab object
DSend the 'notifications.send_email' task to workers every 10 seconds
Step-by-Step Solution
Solution:
  1. Step 1: Understand 'schedule' value

    A numeric value like 10 means seconds interval.
  2. Step 2: Celery Beat behavior

    Celery Beat sends the task to workers every 10 seconds.
  3. Final Answer:

    Send the 'notifications.send_email' task to workers every 10 seconds -> Option D
  4. Quick Check:

    Numeric 'schedule' means periodic seconds interval [OK]
Quick Trick: Numeric schedule means seconds interval [OK]
Common Mistakes:
MISTAKES
  • Assuming 'schedule' must be a crontab object
  • Thinking task runs only once
  • Confusing immediate execution with scheduling

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes