Celery with asyncio?
downdawn opened this issue · 4 comments
downdawn commented
Hi, @wu-clan
Celery scheduled tasks cannot be executed
Solutions related to asyncio
https://stackoverflow.com/questions/39815771/how-to-combine-celery-with-asyncio
The method above uses async_to_sync to forcibly convert to a synchronous method, which runs normally on the Windows 10 system, but requires additional configuration.
# windows 下需要设置环境变量,不推荐使用 windows 下开发 celery
# https://github.com/celery/celery/pull/4078
#
import os
os.environ.setdefault('FORKED_BY_MULTIPROCESSING', '1')
In the CentOS 7 system environment, after deployment using Supervisor and Gunicorn, observe it several times and an exception may occur.
If Celery cannot be compatible with asyncio, then performing database operations within tasks will be affected.
downdawn commented
wu-clan commented
wu-clan commented
Hi, @downdawn
Has successfully run the asynchronous task with a temporary solution, see pr TODO for details.
downdawn commented
nice