I am getting the polling data by running celery beat scheduler and periodic task. I like to share this data with the Django server. this data should available for the entire Django application server. is there anyway? and I don't want to share this data either DB or file. please suggest me to do this in a better way, thank you in advance.
Asked
Active
Viewed 140 times
1 Answers
1
Short answer : what you ask for is not possible, period.
Longer answer : given that a django production setup will run more than one Django process (yes, even with one single server), there's no such thing as "THE" django server and the only way to "share data" from celery workers to the django processes is to store them in "something" that is 1/ available to all the workers and all the django processes and 2/ supports concurrent access - IOW in a database server process of some sort (your SQL db for persistant data, Redis for transiant data).

bruno desthuilliers
- 75,974
- 6
- 88
- 118
-
thank you for your answer, I am new to server process based concepts. could you suggest me to how to achieve 1/ available to all the workers and all Django processes? thank you in advance. – Srikanth Sep 10 '18 at 11:00
-
Quite simply: the celery workers store the data either in your SQL database (the same used by django - which should already be available to your tasks) or in redis (idem), and in your django app fetch the data (here again either from the SQL database or from redis). SQL database servers (I'm not talking about sqlite3 here, but real SQL databases) and Redis _are_ designed to share data amongst applications. All you need to make sure is that the servers that run the workers can connect to the SQL or redis servers, but that's already a precondtion for a django/celery setup to work at all. – bruno desthuilliers Sep 10 '18 at 11:08
-
is there any way possible with rabbitmq server? please let me know? – Srikanth Sep 10 '18 at 11:30
-
rabbitmq is a message queue, not a data store. – bruno desthuilliers Sep 10 '18 at 11:37
-
thank you for your answers, time and concern. actually, I am using SQL, djcelery, and Django. for message queue rabbitmq. without requesting the DB(MySQL) how can I get data? and both are able to access MySQL. thank you in advance. – Srikanth Sep 10 '18 at 12:01