0

I have async task in celery which generates report. Generate report function generates the report and uses the repository class for report to update the status of the report and url report. As I am using asyncpg for connection my database connection is async and hence update_report function in report repository is async. When I make the celery task function async so that I can await on update_report function, it doesn't run anything and throws this warning - RuntimeWarning: coroutine 'generate_report' was never awaited

@celery_app.task(name="generate_report")
async def generate_report(report_id: uuid.UUID):
    """
    generate_report is a celery task which is used to generate the report
    it is called by the create_report endpoint
    """
    print("generating report")
    report_repository = ReportRepository()
    # time.sleep(20)
    response = await report_repository.update_report_url(report_id, "https://www.google.com")
    print("report generated")

0 Answers0