Changes between Version 2 and Version 3 of DeveloperGuidelines/Scheduler
- Timestamp:
- 09/13/12 11:29:25 (12 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
DeveloperGuidelines/Scheduler
v2 v3 1 = Schduler = 2 [[TOC]] 1 3 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. 2 4 … … 14 16 }}} 15 17 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 == 19 Adding 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`. 17 20 18 21 {{{ … … 31 34 }}} 32 35 33 Note that tasks are run without credentials. 36 Note that recurring tasks don't normally use credentials. 37 38 == Asynchronous == 39 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. 40 41 Tasks run in this way normally run as the user who initiated the task. 42 43 e.g.: 44 {{{ 45 def 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 }}}