Tuesday, June 28, 2011

Re: Django-utils @async decorator and gunicorn

Hi!

On 06/27/2011 03:47 PM, Javier Guerra Giraldez wrote:
> On Mon, Jun 27, 2011 at 4:50 AM, Anton Pirker<anton@ignaz.at> wrote:
>> But when i run my django app under gunicorn and i call the function with the
>> @async decorator nothing happens at all...
> are you running the queue consumer daemon?

Ah! There is a queue consumer daemon! ;) Thank's for this hint!

I have now the queue consumer configured in my supervisord.conf like this:

[program:preview_queue_consumer]
environment=PYTHONPATH="/home/preview/.virtualenvs/preview/source/myproject/:/home/preview/.virtualenvs/preview/lib/python2.6/site-packages/djutils/:$PYTHONPATH"
directory=/home/preview/source/myproject/
command=python manage.py queue_consumer --settings=myproject.settings -l
logs/queue_consumer.log --verbosity=2 -t 2
user=preview
autostart=true
autorestart=true


when i start the daemon the logs says this:

delay: 0.1
backoff: 1.15
threads: 2
2011-06-28 09:18:06,329:djutils.queue.logger:INFO:Loaded classes:
djutils.commands.queuecmd_delayed_resize
djutils.queue.queue.QueueCommand
djutils.queue.queue.PeriodicQueueCommand
2011-06-28 09:18:06,329:djutils.queue.logger:INFO:Starting periodic
command execution thread
2011-06-28 09:18:06,329:djutils.queue.logger:INFO:created thread
"1098918224"
2011-06-28 09:18:06,329:djutils.queue.logger:INFO:created thread
"1107310928"

so i assume the daemon is started.

but when i run my @async function nothing happens. in the log output
above i can see that QueueCommand and PeriodicQueueCommand are loaded.
can it be, that the consumer can only consume this sort of functions and
not functions with @async?

i tried to add the @queue_command instead of the @async to my function,
but then i get the error:
"can't pickle StringO objects"
and i do not have a clue what this means. (maybe it's my lack of english
skills, but what should 'pickle' in this context mean?)


anyone an idea or hint where i should look next, to get my @async
functions running in gunicorn?

thank's in advance,
Anton

--
DI(FH) Anton Pirker

---------------------------------------------
IGNAZ Softwaremanufaktur
mobile . web . usability . project management

kranzgasse 2/15
a-1150 wien
tel: +43 699 1234 0 456
skype: antonpirker

http://ignaz.at


--
You received this message because you are subscribed to the Google Groups "Django users" group.
To post to this group, send email to django-users@googlegroups.com.
To unsubscribe from this group, send email to django-users+unsubscribe@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/django-users?hl=en.

No comments:

Post a Comment