Всем привет. Прошу помощи.
Есть код, который запускается на локальной машине и на удаленной. Не могу понять почему, но один и тот же код выполняется по разному, а именно: создается больше количество тасок, чем мне нужно. Идея - выполнять одну таску в минуту. На локальной машине это так и происходит.
app.conf.beat_schedule = {
"create_new_avatar": {
"task": "telegram_user.tasks.telegram_change_avatar",
"schedule": crontab(),
}}
Запускаю код на локальной машине.
celery worker -A config.celery_app -B -l info -n other --concurrency=1
Консоль:
[tasks]
. telegram_user.tasks.telegram_change_avatar
[2021-02-28 17:50:04,651: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672//
[2021-02-28 17:50:04,672: INFO/MainProcess] mingle: searching for neighbors
[2021-02-28 17:50:05,591: INFO/Beat] beat: Starting...
[2021-02-28 17:50:05,676: INFO/Beat] Scheduler: Sending due task create_new_avatar (telegram_user.tasks.telegram_change_avatar)
[2021-02-28 17:50:06,064: INFO/MainProcess] mingle: all alone
[2021-02-28 17:50:06,102: INFO/MainProcess] celery@other ready.
[2021-02-28 17:50:06,119: INFO/MainProcess] Received task: telegram_user.tasks.telegram_change_avatar[827646b1-6587-4de9-b7b8-1fdc3f6a8d08]
[2021-02-28 17:50:07,022: INFO/ForkPoolWorker-2] Connecting to 149.154.167.51:443/TcpFull...
[2021-02-28 17:50:07,299: INFO/ForkPoolWorker-2] Connection to 149.154.167.51:443/TcpFull complete!
[2021-02-28 17:50:08,323: INFO/ForkPoolWorker-2] Uploading file of 108247 bytes in 1 chunks of 131072
[2021-02-28 17:50:09,379: INFO/ForkPoolWorker-2] Uploading file of 108247 bytes in 1 chunks of 131072
[2021-02-28 17:50:10,602: INFO/ForkPoolWorker-2] Disconnecting from 149.154.167.51:443/TcpFull...
[2021-02-28 17:50:10,603: INFO/ForkPoolWorker-2] Disconnection from 149.154.167.51:443/TcpFull complete!
[2021-02-28 17:50:10,616: INFO/ForkPoolWorker-2] Avatar is changed in 2021-02-28 17:50:10.615904
Но тот же самый код, запущенный на удаленном сервере:
[tasks]
. telegram_user.tasks.telegram_change_avatar
[2021-02-28 18:01:37,130: INFO/Beat] beat: Starting...
[2021-02-28 18:01:37,153: INFO/MainProcess] Connected to amqp://guest:**@127.0.0.1:5672//
[2021-02-28 18:01:37,182: INFO/MainProcess] mingle: searching for neighbors
[2021-02-28 18:01:37,250: INFO/Beat] Scheduler: Sending due task create_new_avatar (telegram_user.tasks.telegram_change_avatar)
[2021-02-28 18:01:38,238: INFO/MainProcess] mingle: all alone
[2021-02-28 18:01:38,256: INFO/MainProcess] celery@other ready.
[2021-02-28 18:01:38,271: INFO/MainProcess] Received task: telegram_user.tasks.telegram_change_avatar[e3690979-cd2a-4413-b5ad-f99a8e7cc44a]
[2021-02-28 18:01:38,272: INFO/MainProcess] Received task: telegram_user.tasks.telegram_change_avatar[b872d117-b4c7-4538-8c38-d07ad1e16164]
[2021-02-28 18:01:38,273: INFO/MainProcess] Received task: telegram_user.tasks.telegram_change_avatar[b0e1470e-7bb7-41c2-bf38-613399266e8c]
[2021-02-28 18:01:38,273: INFO/MainProcess] Received task: telegram_user.tasks.telegram_change_avatar[290f86ce-5be9-4606-aa42-fe8c0ef55ebf]
[2021-02-28 18:01:38,381: INFO/MainProcess] Received task: telegram_user.tasks.telegram_change_avatar[10138e04-6bf9-4ee3-a134-f771b4002b3e]
[2021-02-28 18:01:39,647: INFO/ForkPoolWorker-2] Connecting to 149.154.167.51:443/TcpFull...
[2021-02-28 18:01:39,657: INFO/ForkPoolWorker-2] Connection to 149.154.167.51:443/TcpFull complete!
[2021-02-28 18:01:39,858: INFO/ForkPoolWorker-2] Uploading file of 102594 bytes in 1 chunks of 131072
[2021-02-28 18:01:39,938: INFO/ForkPoolWorker-2] Uploading file of 102594 bytes in 1 chunks of 131072
[2021-02-28 18:01:40,132: INFO/ForkPoolWorker-2] Disconnecting from 149.154.167.51:443/TcpFull...
[2021-02-28 18:01:40,133: INFO/ForkPoolWorker-2] Disconnection from 149.154.167.51:443/TcpFull complete!
[2021-02-28 18:01:40,143: INFO/ForkPoolWorker-2] Avatar is changed in 2021-02-28 18:01:40.143742
Создается пять задач, когда я рассчитываю лишь на одну. Подскажите пожалуйста какую документацию мне прочитать, не могу понять, по какой причине это может так срабатывать.