you may use the taskqueue from inside your controllers or modules.
here's a sample invocation that i used recently:
taskqueue.add(
url=URL(r=request, f=function_to_run),
params={
'created_on':start,
'end':chunk_end,
'prefix':request.vars.prefix or '',
'email_to':request.vars.email_to,
},
method='GET',
)
using additional parameter you can specify which queue to target and how
long to wait before the task is run.
i also use GAE cron.yaml to schedule the execution of controller methods at
specified times each day.
On Tuesday, June 4, 2013 3:09:26 AM UTC-7, José Manuel López wrote:
>
> Hi Niphlod,
> Do you have any example about how use GAE tash queue from web2py?, can I
> use it inside my main controller without problem?
> something like this:
>
> # Add the task to the default queue.
> taskqueue.add(url='/worker', params={'key': key})
>
>
> I've see this example:
> https://developers.google.com/appengine/docs/python/taskqueue/overview-pushbut
> I'm lost about how to use it from my controller and Web2Py.
> Thanks!
>
>
> On Monday, June 3, 2013 9:12:14 PM UTC+2, Niphlod wrote:
>>
>> ehmm...... scheduler is NOT meant to be run on GAE. They have task queue
>> for that.
>>
>> On Monday, June 3, 2013 7:59:45 PM UTC+2, José Manuel López wrote:
>>>
>>> Hi Massimo,
>>> this is my Web2Py version: Version
>>> 2.4.6-stable+timestamp.2013.04.06.17.37.38
>>> And I'm running on 2.5 Python version, maybe I've to switch to 2.7?.
>>>
>>>
>>> On Monday, June 3, 2013 6:56:16 PM UTC+2, Massimo Di Pierro wrote:
>>>>
>>>> Which web2py version? Which Python version? You may be on an early
>>>> Python version that does include multiprocessing.
>>>>
>>>> On Monday, 3 June 2013 11:01:38 UTC-5, José Manuel López wrote:
>>>>>
>>>>> Hi,
>>>>> I've a function call SendReport that send an email to every user in my
>>>>> system every day (morning), something like a newsletter.
>>>>> Now, I've to make this task with the scheduler but I'm not sure how to
>>>>> do it.
>>>>> I've see the video (thanks Massimo), but I'm not sure where I've to do
>>>>> it.
>>>>> This is my code:
>>>>>
>>>>> Scheduler(db, dict(sendReport=sendReport()))
>>>>>
>>>>>
>>>>> I've done it in a file task.py inside models and inside my main
>>>>> controller... but it's not working it throws me this trace:
>>>>>
>>>>> ImportError: Cannot import module 'multiprocessing'
>>>>>
>>>>> What I'm doing wrong?.
>>>>> Thank you for your help!
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
--
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.