Celery
Setup
# Other imports ...
from pyot.conf.utils import import_confs
# Celery settings stuff ...
import_confs("<pyotconf_import_path>")Tasks
from pyot.core.resources import resource_manager
from pyot.utils.sync import async_to_sync
# ...
@app.task
@async_to_sync
@resource_manager.as_decorator
async def task_using_decorator():
...
# OR
@app.task
@async_to_sync
async def task_using_context_manager():
async with resource_manager():
...Last updated