Django

Django & Celery

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

22 питань зі співбесід·
Senior
1

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

Відповідь

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?

Відповідь

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?

Відповідь

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 питань зі співбесід

Опануй Django для наступної співбесіди

Отримай доступ до всіх питань, flashcards, технічних тестів, вправ code review та симуляторів співбесід.

Почни безкоштовно