Bird
0
0

Given this Celery Beat schedule snippet, what will happen?

medium📝 component behavior Q13 of 15
Flask - Background Tasks
Given this Celery Beat schedule snippet, what will happen?
beat_schedule = {
'print-every-10-seconds': {
'task': 'app.print_message',
'schedule': 10,
},
}
AThe task runs once after 10 seconds
BThe task runs every 10 minutes
CThe task 'print_message' runs every 10 seconds
DThis code causes a syntax error
Step-by-Step Solution
Solution:
  1. Step 1: Understand the schedule value

    The 'schedule' key with value 10 means the task runs every 10 seconds.
  2. Step 2: Confirm task repetition

    Celery Beat schedules tasks repeatedly at the interval given, so it runs every 10 seconds, not once or every 10 minutes.
  3. Final Answer:

    The task 'print_message' runs every 10 seconds -> Option C
  4. Quick Check:

    Schedule=10 means every 10 seconds [OK]
Quick Trick: Schedule number means seconds interval by default [OK]
Common Mistakes:
MISTAKES
  • Thinking schedule is minutes instead of seconds
  • Assuming task runs only once
  • Confusing syntax with crontab format

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes