Changes between Version 2 and Version 3 of DeveloperGuidelines/Scheduler


Ignore:
Timestamp:
09/13/12 11:29:25 (12 years ago)
Author:
Fran Boon
Comment:

--

Legend:

Unmodified
Added
Removed
Modified
  • DeveloperGuidelines/Scheduler

    v2 v3  
     1= Schduler =
     2[[TOC]]
    13The 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.
    24
     
    1416}}}
    1517
    16 Task schedules are configured by using [http://pub.nursix.org/eden/s3/s3.s3task.S3Task-class.html#schedule_task s3task.schedule_task()] in `/models/zzz_1st_run.py`.
     18== Recurring Tasks ==
     19Adding a schedule for a recurring task can be done by using [http://pub.nursix.org/eden/s3/s3.s3task.S3Task-class.html#schedule_task s3task.schedule_task()] in `/models/zzz_1st_run.py`.
    1720
    1821{{{
     
    3134}}}
    3235
    33 Note that tasks are run without credentials.
     36Note that recurring tasks don't normally use credentials.
     37
     38== Asynchronous ==
     39The 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.
     40
     41Tasks run in this way normally run as the user who initiated the task.
     42
     43e.g.:
     44{{{
     45def stats_data_onapprove(row):
     46    """
     47       When a stats_data record is approved then the related stats_aggregate
     48       fields need to be updated so that the results are kept up to date.
     49
     50       This is done async as this can take some time
     51    """
     52    current.s3task.async("stats_update_time_aggregate",
     53                         args = [row.data_id],
     54                         )
     55}}}