Bird
0
0

Why might a Celery task never execute even though the Flask app calls task.delay() correctly?

medium📝 Debug Q7 of 15
Flask - Background Tasks
Why might a Celery task never execute even though the Flask app calls task.delay() correctly?
AThe task function is missing a return statement
BThe Flask app is running in debug mode
CThe Celery worker process is not running
DThe broker URL uses an unsupported protocol
Step-by-Step Solution
Solution:
  1. Step 1: Consider task execution requirements

    Tasks require a running Celery worker to be picked up and executed.
  2. Step 2: Evaluate other options

    Flask debug mode and missing return do not prevent task execution; unsupported protocol would cause connection errors.
  3. Final Answer:

    The Celery worker process is not running -> Option C
  4. Quick Check:

    Worker must run to execute tasks [OK]
Quick Trick: Always start Celery worker to run tasks [OK]
Common Mistakes:
MISTAKES
  • Ignoring need for worker process
  • Blaming Flask debug mode
  • Thinking return statement is mandatory

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Flask Quizzes