R
R
Ramil Akperov2022-04-05 07:57:32
Task Schedulers
Ramil Akperov, 2022-04-05 07:57:32

What is the difference between Cron and Celery?

Hello!

Could someone explain briefly and clearly how Cron differs from Celery?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Alexander Nesterov, 2022-04-05
@Ramil03

cron is a "function" of linux systems to run scheduled tasks. Most "primitive". Told her to "pull [filename].py [every day at 6]/[every 15 minutes]" (conditionally), she would do it.
celery is a python library that allows you to:

  • do the same, but directly in the code (which allows you to abstract from the OS).
  • Add "tasks" to the task queue, which allows code to be executed without waiting for any process to terminate.

Why is the second necessary? For example, to download large files. If you do a view in the main body, then there is a great chance to catch a timeout error. Therefore, the main data is stored in the main body, and the file is loaded in a separate task.
Also, it can be used to work with external services, such as mail. Here the situation is about the same as with files: if you want to send an email, but the server does not respond for a long time - catch the timeout.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question