Bird
0
0

How do you correctly invoke a Celery task named generate_report so that it runs asynchronously?

easy📝 Syntax Q3 of 15
Django - Celery and Background Tasks
How do you correctly invoke a Celery task named generate_report so that it runs asynchronously?
Agenerate_report.delay()
Bgenerate_report()
Cgenerate_report.run()
Dgenerate_report.async()
Step-by-Step Solution
Solution:
  1. Step 1: Identify the asynchronous call method

    Celery tasks are called asynchronously using the delay() method.
  2. Step 2: Apply to the task

    Calling generate_report.delay() queues the task for asynchronous execution.
  3. Final Answer:

    generate_report.delay() -> Option A
  4. Quick Check:

    Only delay() triggers async execution [OK]
Quick Trick: Use .delay() to call Celery tasks asynchronously [OK]
Common Mistakes:
MISTAKES
  • Calling the task function directly runs it synchronously
  • Using .run() or .async() methods which don't exist
  • Forgetting to use .delay() for async execution

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes