I'm implementing a celery queue-worker system, but I want to be able to call an existing library function/coroutine that is marked async
. I'm getting OSErrors with loop.run_until_complete()
which I assume is from trying to run event loops in a non-single threaded manner.
import asyncio
from celery import Celery
app = Celery('blah', broker='redis://localhost:6379/0')
async def async_func():
asyncio.sleep(20)
@app.task
def task():
# what do I do here to run async_func?
pass