How to solve the minor problems in SORA celery Research
This article shows you how to solve the small problems in SORA celery research, the content is concise and easy to understand, it will definitely brighten your eyes. I hope you can get something through the detailed introduction of this article.
Sora's rpc mechanism is intended to use celery processing, celery+rabbitmq. Recently I started to study its documentation and tried to write a piece of code.
From celery import Celeryapp = Celery ('cagent',backend='redis://localhost',broker='amqp://guest@localhost//') # app.conf.update (# CELERY_TASK_SERIALIZER='json',# CELERY_ACCEPT_CONTENT= [' json'], # Ignore other content# CELERY_RESULT_SERIALIZER='json',#) app.conf.CELERY_TASK_SERIALIZER='json'app.conf.CELERY_ACCEPT_CONTENT= ['json'] app.conf.CELERY_RESULT_SERIALIZER='json'@app.taskdef add (x Y): return Xeroy
For configuring variables such as CELERY_ACCEPT_CONTENT, you can simply configure it centrally using a python module, or you can write the configuration into the program as in this example, or you can use configparser to read files of type conf to configure.
When I tried to put
App.conf.CELERY_ACCEPT_CONTENT= ['json']
['json'] when the curly braces at both ends are removed, an error is raised
If the curly braces are not removed, there will be no such problem. There are also braces in the document.
The above is how to solve the small problems in SORA celery research. Have you learned the knowledge or skills? If you want to learn more skills or enrich your knowledge reserve, you are welcome to follow the industry information channel.