How about using the caching framework for shared state? 
http://projects.unbit.it/uwsgi/wiki/CachingFramework (I know, it's not in the 
new docs yet. Working on it when I have the time...)

I feel it _should_ work for spooler tasks too. Haven't tried though :)

- Aarni

From: [email protected] [mailto:[email protected]] On 
Behalf Of est
Sent: Tuesday, November 20, 2012 4:18 PM
To: [email protected]
Subject: [uWSGI] RPC / message in uwsgi

Hi all,


I followed this "Example: a Django session cleaner and video encoder"
http://projects.unbit.it/uwsgi/wiki/Decorators

so far I have aawesome spooler doing some sql processing, in a LOT of rows.

And I'd like to provide a AJAX query API to view the progress, so my django 
site is:

/task/1/start
/task/1/status

The first URL start the spooler in the background, and on the page I have a 
ajax polling the second URL to display some state nad the percentage of 
progress from the previous started running spooler.

The percentage is the current row index devided by total rows.

I don't want to mess with Celery or other 3rd-party services, I want to do this 
all in uwsgi+django framework.

I tried the RPC way
http://projects.unbit.it/uwsgi/wiki/RPC

using the @rpc decorator in one of my my class methods, says the self parameter 
not found, wrote a get_status() function, modify a global status variable, 
didn't work because the global variable wasn't modified even the spooler is 
running.

I looked into the possibilities of SignalFramework, Subscription system  and 
send_to_spooler() functions, can not solve my problem. The thing is, there are 
tons of way to send information to a spooler, but seems impossible for to poll 
running information from a spooler.

so my question is, what's the best practice to pass a shared state from a 
running spooler to worker? Any message passing framework exists in uwsgi? (or 
should I have some middle shared data? but how?)

Thanks in advance!
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to