Bird
0
0

Which of the following is the correct syntax to retry a Celery task after an exception?

easy📝 Syntax Q3 of 15
Django - Celery and Background Tasks
Which of the following is the correct syntax to retry a Celery task after an exception?
Araise self.retry(exc=exception, countdown=60)
Bself.retry(exception, delay=60)
Cretry_task(exception, wait=60)
Dtask.retry(exception, countdown=60)
Step-by-Step Solution
Solution:
  1. Step 1: Recall Celery retry syntax

    Celery tasks use raise self.retry() with exc and countdown parameters.
  2. Step 2: Check options for correct method and parameters

    Only raise self.retry(exc=exception, countdown=60) matches the correct syntax exactly.
  3. Final Answer:

    raise self.retry(exc=exception, countdown=60) -> Option A
  4. Quick Check:

    Correct retry syntax = raise self.retry(...) [OK]
Quick Trick: Use raise self.retry with exc and countdown [OK]
Common Mistakes:
MISTAKES
  • Calling retry without raise
  • Using wrong parameter names
  • Calling retry on task instead of self

Want More Practice?

15+ quiz questions · All difficulty levels · Free

Free Signup - Practice All Questions
More Django Quizzes