0
from celery.bin.worker import worker
from my_project import consumer_app

def start_worker():
    logger.info("Starting workers..")
    while True:
        try:
            worker(app=consumer_app).execute_from_commandline()

        except Exception as err:
            print("Restarting worker processor, due to {}".format(err))
            time.sleep(10)


if __name__ == '__main__':
    start_worker()


Recently, I upgraded the celery version from 4.4.7 to 5.3.1. I also have upgraded the Python version from 3.6 to 3.11. The above code is working fine on Python3.6 and Celery v4.4.7 combination.

However, after upgrading it on Python 3.11 with Celery latest version i.e 5.3.1 getting the below error:

Context.init() got an unexpected keyword argument 'app'

Try with the worker.Worker(app=consumer_app) but still it is not successful.

0 Answers0