Changes between Version 41 and Version 42 of TracCronPlugin
- Timestamp:
- Feb 11, 2014, 12:45:04 PM (10 years ago)
Legend:
- Unmodified
- Added
- Removed
- Modified
-
TracCronPlugin
v41 v42 5 5 == Description == 6 6 7 This plugin add a scheduler inside Trac process that can handle any sort8 of task writ ing inpython language. Main features are:7 This plugin adds a scheduler inside the Trac process that can handle any sort 8 of task written in the python language. Main features are: 9 9 10 10 * Task are plugin … … 16 16 * Task execution history '''new''' ''rss feed is available'' 17 17 18 The plugin provide an administration panel to help scheduling.19 20 [[Image(tcp_admin_panel.png, 640)]]18 The plugin provides an administration panel to help scheduling. 19 20 [[Image(tcp_admin_panel.png, 80%)]] 21 21 22 22 == Bugs/Feature Requests == … … 51 51 == Example == 52 52 53 My company need to synchronize trac user with an external source of account. The job was made by an ETL but fine tuning of trac user was still done by a our modified version of Trac by clicking on a button on the admin panel that call a well designed API. So instead of manually clik on the button i searched a way to automate it. Unfortunately, i did not find any plugin for this and even if i could use a unix cron task or an windows AT command to plane the task, ithought it would be better done inside Trac process.54 55 So if you have any function for entry point of a process ( imean trac related process) and you want to plane it as a job, Trac Cron Plugin is for you.56 57 Simply create in a module (.py) a class that implement the ICronTask and put it inside plugins directory. Then you can either trick the trac.ini either comfortably use the dedicated admin panel.53 My company needed to synchronize trac users with an external account source. The job was done by an ETL but fine tuning of trac user was still done by a our modified version of Trac by clicking on a button on the admin panel that call a well designed API. So instead of manually clicking on the button I searched for a way to automate it. Unfortunately, I did not find any plugin for this and even if I could use a unix cron task or an windows AT command to plane the task, I thought it would be better done inside Trac process. 54 55 So if you have any function for entry point of a process (I mean trac related process) and you want to plane it as a job, Trac Cron Plugin is for you. 56 57 Simply create in a module (.py) a class that implements the ICronTask and put it inside the plugins directory. Then you can either trick the trac.ini either comfortably use the dedicated admin panel. 58 58 59 59 === How to write a task === 60 60 61 You have to write python class that inherit of ICronTask which code is below:61 You have to write python class that inherits of ICronTask which code is below: 62 62 {{{ 63 63 #!python … … 112 112 }}} 113 113 114 You need to implement sthe interface and to put the definition of the task inside the '''wake_up''' method114 You need to implement the interface and to put the definition of the task inside the '''wake_up''' method 115 115 116 116 === How to install the task === 117 117 118 Since task are component you just have to put the class definition of your task in a python module inplugins directory.118 Since tasks are components you just have to put the class definition of your task in a python module in the plugins directory. 119 119 You can either create a .py file and put it in plugins directory or package the .py file into an eggs you'll leave in plugins directory. 120 120 … … 123 123 == Configuration == 124 124 125 The plugin can entirely be configured both witn trac.ini oradministration panel.125 The plugin can be entirely configured from either trac.ini or the administration panel. 126 126 The section name of TracCronPlugin is traccron, here is a full sample 127 127 … … 173 173 }}} 174 174 175 This is the second way to enable or disable a task. Since ''ticker_enabled'' is global and so all task will be affected, this key only affect one task. If False, w athever schedule the task have, no one will be trigged, so this is a way to disable a task while keep all the schedule in place for the time you will enable the task. Default is '''True'''.175 This is the second way to enable or disable a task. Since ''ticker_enabled'' is global and so all task will be affected, this key only affect one task. If False, whatever schedule the task have, no one will be triggered, so this is a way to disable a task while keep all the schedule in place for the time you will enable the task. Default is '''True'''. 176 176 177 177 … … 191 191 }}} 192 192 193 The goal of this scheduler is to trigger task every hours. You prov ode minute when you want the task to be executed. Accept comma sparated list of values. Default is no value.193 The goal of this scheduler is to trigger task every hours. You provide minute when you want the task to be executed. Accept comma separated list of values. Default is no value. 194 194 195 195 … … 199 199 }}} 200 200 201 This sc eduler trigger task that need to be executed once a month. You provide the day in month and the hour when the task will be launched. The day is the index of the day starting at 1. Accept comma separated value. Default is no value201 This scheduler trigger task that need to be executed once a month. You provide the day in month and the hour when the task will be launched. The day is the index of the day starting at 1. Accept comma separated value. Default is no value 202 202 203 203 … … 211 211 ==== Enable/Disable a schedule ==== 212 212 213 Each schedule can individual y be enabled or disabled. This the configuration for daily scheduler:213 Each schedule can individually be enabled or disabled. This the configuration for daily scheduler: 214 214 215 215 {{{ … … 218 218 }}} 219 219 220 This enable or disablethe trigger. If False, the scheduler will not trigger the task. Default is '''True'''.220 This enables or disables the trigger. If False, the scheduler will not trigger the task. Default is '''True'''. 221 221 222 222 ==== Pass argument to a task ==== 223 223 224 You can pass argument to the task in a per schedule basis. Here an example for daily schedule:224 You can pass arguments to the task on a per schedule basis. Here an example for daily schedule: 225 225 226 226 {{{ … … 229 229 }}} 230 230 231 When the daily schedule will trigger the task, the value of the key will bepassed to the '''wake_up''' call. Parameters can be coma separated multiple value. Default is '''empty'''231 When the daily schedule triggers the task, the value of the key is passed to the '''wake_up''' call. Parameters can be coma separated multiple value. Default is '''empty''' 232 232 233 233 == Bundled Task == 234 234 235 Beside the HearBeat task provided for testing purpose, TracCronPlugin come withfollowing useful task.235 Besides the HearBeat task provided for testing purpose, TracCronPlugin comes with the following useful task. 236 236 237 237 === sleeping_ticket === 238 238 239 This task remind reporter about orphaned ticket and assigned user about sleeping ticket. Orphaned ticket is a ticket in new status since more than a given amount of day. An email notification is sent to the reporter in such a case. A sleeping ticket is a ticket assigned to an user, but the user either did not accept it or did not touch the ticket(make comment for example) since more than a given amount of day. The assigned user is notified in such a case. The delay is an optional parameter associated with each schedule. Default value is '''3 day'''.239 This task reminds reporter about orphaned ticket and assigned user about sleeping ticket. An orphaned ticket is a ticket in new status since more than a given amount of day. An email notification is sent to the reporter in such a case. A sleeping ticket is a ticket assigned to an user, but the user either did not accept it or did not touch the ticket(make comment for example) since more than a given amount of day. The assigned user is notified in such a case. The delay is an optional parameter associated with each schedule. Default value is '''3 day'''. 240 240 241 241 === unreachable milestone === … … 263 263 264 264 265 Best regard .265 Best regards. 266 266 267 267 --