Version 4 (modified by James O'Neill, 9 years ago) ( diff )

Fix kwarg name


The scheduler is used for asynchronous tasks (not from a user request to the web server). It is used for daily instance maintenance and for processing and sending messages.

The Eden scheduler is a wrapper to the web2py scheduler.

New Task

To create a new function in /models/ for your new task, and point to it by setting a value in the tasks dictionary, e.g.,

def my_task(*args, **kwargs):
        return result

tasks["my_task"] = my_task

Recurring Tasks

Adding a schedule for a recurring task can be done by using s3task.schedule_task() in /models/

                "bar": "cha",
        period=300, # every 5 minutes
        repeats=0 # repeat forever

Note that recurring tasks don't normally use credentials.


The scheduler can be used to 'push work async' so that the browser page returns to the user, whilst the task then runs in the background.

Tasks run in this way normally run as the user who initiated the task.


def stats_data_onapprove(row):
       When a stats_data record is approved then the related stats_aggregate
       fields need to be updated so that the results are kept up to date.

       This is done async as this can take some time
                         args = [row.data_id],
Note: See TracWiki for help on using the wiki.