Django

Django & Celery

Celery setup, tasks, periodic tasks, task routing, retry strategies, monitoring, beat scheduler

22 pertanyaan wawancara·
Senior
1

What is the main role of Celery in a Django application?

Jawaban

Celery is a distributed asynchronous task queue that allows executing long-running or resource-intensive operations in the background, without blocking HTTP requests. This improves user experience by making the application more responsive, particularly for sending emails, image processing, or intensive computations.

2

Which Celery component is responsible for storing pending task messages?

Jawaban

The message broker (like Redis or RabbitMQ) is the central component that stores task messages pending execution. It acts as an intermediary between the task producer (Django) and the Celery workers that consume and execute these tasks.

3

How to define a basic Celery task in a Django application?

Jawaban

A Celery task is defined by using the @shared_task or @app.task decorator on a Python function. The @shared_task decorator is preferred as it allows reusing the task across different applications without depending on a specific Celery instance.

4

What is the difference between task.delay() and task.apply_async()?

5

Which file is typically created at the root of the Django project to configure Celery?

+19 pertanyaan wawancara

Kuasai Django untuk wawancara berikutnya

Akses semua pertanyaan, flashcards, tes teknis, latihan code review dan simulator wawancara.

Mulai gratis