| 28 | == Install == |
---|
| 29 | You can install this software as normal Trac plugin. |
---|
| 30 | |
---|
| 31 | 1. Uninstall Trac Scheduler if you have installed before. |
---|
| 32 | |
---|
| 33 | 2. Change to the directory containning setup.py. |
---|
| 34 | |
---|
| 35 | 3. If you want to install this plugin globally, that will install this plugin to the python path: |
---|
| 36 | * python setup.py install |
---|
| 37 | |
---|
| 38 | 4. If you want to install this plugin to trac instance only: |
---|
| 39 | * python setup.py bdist_egg |
---|
| 40 | * copy the generated egg file to the trac instance's plugin directory |
---|
| 41 | {{{ |
---|
| 42 | cp dist/*.egg /srv/trac/env/plugins |
---|
| 43 | }}} |
---|
| 44 | |
---|
| 45 | 5. Config trac.ini: |
---|
| 46 | {{{ |
---|
| 47 | [components] |
---|
| 48 | tracscheduler.* = enabled |
---|
| 49 | |
---|
| 50 | [tracscheduler] |
---|
| 51 | ; tasks poll interval is 60 sec |
---|
| 52 | poll_interval = 60 |
---|
| 53 | ; task invoke interval is 1 sec |
---|
| 54 | worker_interval = 1 |
---|
| 55 | }}} |
---|
| 56 | |
---|
28 | | TBD |
---|
| 59 | This following plugin will logging the latest 2 ticket ids every 1 minute. |
---|
| 60 | |
---|
| 61 | {{{ |
---|
| 62 | from tracscheduler.web_ui import IScheduledTask |
---|
| 63 | |
---|
| 64 | class TracSchedulerTest(Component): |
---|
| 65 | implements(IScheduledTask) |
---|
| 66 | def process_scheduled_task(self, parent): |
---|
| 67 | self.log.debug("TracSchedulerTest") |
---|
| 68 | sqlString = "SELECT id FROM ticket ORDER BY id DESC LIMIT 2;" |
---|
| 69 | rows = parent.queryDb(sqlString) |
---|
| 70 | self.log.debug(rows) |
---|
| 71 | |
---|
| 72 | }}} |
---|