Python Forum

Full Version: Receive data from Redis RQ worker process
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

I am currently trying to get my Flask Web Application working with Redis RQ.

My application gets an input file and analyzes it for approx. 20 seconds. During the analysis it keeps an filling a dictionary, consisting of dictionaries, which I want to access from my flask application to display the content of this dictionary in a nice way, like plots and graphs.

Now my idea is to allow the user to upload the file and hit "Analyze", which starts my program. Instead of waiting 20 seconds until the file has been processes and redirecting the user then to the page with all the plots I want to let my program run in the background. So if you click "Analyze" the browser directs the user directly to the page with the plots while in the background my analysis program is running.

For the task queue I am using redis RQ. The problem is, that I have no idea how I can access the dictionary, that is being filled by the worker process, through my flask application. Because the content of the dictionary keeps on growing I want to be able to present the user the live output as the analysis process keeps on running.

I tried using the job.meta function but I don't know if this function is really suited for a dictionary that can get quite big in size.

My question is: Can I have my worker process keep on writing the contents of the dictionary to a database, which then can be accessed by my flask application? Sort of like a middle man, that can be polled for results as the database keeps on growing.



Thank you