Hi Riccardo
thank for your help, but the problem persists

On Thu, Dec 1, 2011 at 14:42, Riccardo Magliocchetti <
[email protected]> wrote:

> Hi Francisco,
>
> Il 01/12/2011 13:32, Francisco Costa ha scritto:
>
>  Hi Riccardo,
>>
>> In /etc/init.d/uwsgi I've got:
>>
>> DAEMON_OPTS="-s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d /var/log/uwsgi.log
>> --pythonpath $PYTHONPATH --module $MODULE --harakiri-verbose --spooler
>> $MYSPOOL"
>> where MYSPOOL=/home/franciscocosta/**spooler
>>
>
> here you are missing an --import yourapp.your_module_**containing_test


I now have DAEMON_OPTS="-s 127.0.0.1:9001 -M 4 -t 30 -A 4 -p 4 -d
/var/log/uwsgi.log --pythonpath $PYTHONPATH --module $MODULE
--harakiri-verbose --spooler /home/franciscocosta/spooler --import
/opt/web2py/applications/app/modules/test.py"

The content of test.py is:

from uwsgidecorators import *
@spool
def test_function(args):
    name = 'name'
    for a in range(2000):
        db.person.insert(name = name + str(a))
    return x.id



>
>  I've also got uwsgidecorators.py (
>> http://projects.unbit.it/**uwsgi/browser/uwsgidecorators.**py<http://projects.unbit.it/uwsgi/browser/uwsgidecorators.py>)
>> in my
>> application modules folder.
>>
>> In my default controller I have this function test():
>>
>> from uwsgidecorators import *
>> @spool
>> def test():
>>     for a in range(2000):
>>         db.person.insert(name = 'name' + str(a))
>>     return a
>>
>> but when I open http://localhost/test I get this error: TypeError:
>> 'spool'
>> object is not callable
>>
>
> that's strange, no idea if it it may hurt but are you using
> uwsgidecorators.py from latest mercurial with an older uwsgi release?
>

I have uwsgi 0.9.9.2 installed, and I've changed uwsgidecorators.py to the
one that comes in 0.9.9.2. I have uwsgidecorators.py in app/modules

In the controller default.py I have

from test import *
def test():
    test_function()
    return 'qwe'

but when I access http://localhost/test i still get TypeError: 'spool'
object is not callable

I've already restart multiple types uwsgi but the problem persists



>
> btw, Please don't top post :)
>
> cheers,
> riccardo
>
>
>>
>> On Thu, Dec 1, 2011 at 11:14, Riccardo Magliocchetti<
>> riccardo.magliocchetti@gmail.**com <[email protected]>>
>>  wrote:
>>
>>  Hi,
>>>
>>> Il 01/12/2011 11:41, Francisco Costa ha scritto:
>>>
>>>  Hi,
>>>>
>>>> I'm using web2py + nginx + uwsgi
>>>>
>>>> I have a function where I get the users database and then I email them
>>>> one
>>>> by one.
>>>>
>>>> But when I run this function the page hangs for a few seconds and just
>>>> loads after all those emails been sent.
>>>>
>>>> I was wondering if this problem is possible to solve with the @spool
>>>> decorator<http://projects.**un**bit.it/uwsgi/wiki/Decorators<http://unbit.it/uwsgi/wiki/Decorators>
>>>> <h**ttp://projects.unbit.it/uwsgi/**wiki/Decorators<http://projects.unbit.it/uwsgi/wiki/Decorators>
>>>> >
>>>> **>, and how do you
>>>> implement it.
>>>>
>>>>
>>> You need to change your config file to add a 'spooler' directive with the
>>> directory where you want to let the spooler save its jobs, then an
>>> 'import'
>>> directive with the python module where the function with the @spool
>>> decorator is available. You then need to update your view to call
>>> your_function.spool().
>>> Also please remember that you need to have the decorators.py module
>>> available so you can copy it inside your application.
>>>
>>> hope this helps,
>>> riccardo
>>>
>> ______________________________**_________________
> uWSGI mailing list
> [email protected]
> http://lists.unbit.it/cgi-bin/**mailman/listinfo/uwsgi<http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi>
>
_______________________________________________
uWSGI mailing list
[email protected]
http://lists.unbit.it/cgi-bin/mailman/listinfo/uwsgi

Reply via email to