| 1 | [[PageOutline(2-5,Contents,pullout)]] |
| 2 | |
| 3 | = A job scheduler and monitoring plug-in for Trac = |
| 4 | |
| 5 | == Description == |
| 6 | |
| 7 | The plugin lets you set up and manage and monitor scheduled jobs. It adds the following new Admin screens to Trac: |
| 8 | * Job Admin - List and lets you add, edit and delete jobs. |
| 9 | * Job Status Map - Where you can see the status of the last run of all the jobs. From here you can drill down to the run view of a particular job. |
| 10 | * Run View - Lists all job runs, showing you the runs status form where you can drill down to the runs log. |
| 11 | * Log Admin - Clean-up logs and other tasks. |
| 12 | |
| 13 | Each job run environment and schedule is specified by the version of a single configuration file - a python script - in the SCM. Therefore any changes are carefully tracked. This script is used to create the sandbox and invoke the job. |
| 14 | |
| 15 | == Bugs/Feature Requests == |
| 16 | |
| 17 | Existing bugs and feature requests for JobControlPlugin are |
| 18 | [report:9?COMPONENT=JobControlPlugin here]. |
| 19 | |
| 20 | If you have any issues, create a |
| 21 | [http://trac-hacks.org/newticket?component=JobControlPlugin&owner=thanos new ticket]. |
| 22 | |
| 23 | == Download == |
| 24 | |
| 25 | Download the zipped source from [download:jobcontrolplugin here]. |
| 26 | |
| 27 | == Source == |
| 28 | |
| 29 | You can check out JobControlPlugin from [http://trac-hacks.org/svn/jobcontrolplugin here] using Subversion, or [source:jobcontrolplugin browse the source] with Trac. |
| 30 | |
| 31 | == Example == |
| 32 | |
| 33 | Here is an example of a job configuration. |
| 34 | {{{ |
| 35 | #!python |
| 36 | from jobplugin import JobSpec, today |
| 37 | |
| 38 | from logging import DEBUG |
| 39 | |
| 40 | class MyJob(JobSpec): |
| 41 | """ |
| 42 | Run this script with logging in debug mode. |
| 43 | Run every 45 minutes. |
| 44 | Run /usr/local/etc/myscript at yesterday's date as a command argument. |
| 45 | """ |
| 46 | grouping="/All Jobs/Tests" |
| 47 | log_level=DEBUG |
| 48 | cron="* * * 45"; |
| 49 | cmd ="/usr/local/etc/myscript --date=%s"; % today(-1) |
| 50 | run= "runA, runB"; |
| 51 | |
| 52 | def setUp(self): |
| 53 | pass |
| 54 | def tearDown(self): |
| 55 | pass |
| 56 | def runA(self): pass |
| 57 | |
| 58 | @dependsOn(runA) |
| 59 | def runB(self): pass |
| 60 | |
| 61 | |
| 62 | |
| 63 | MyJob.run() |
| 64 | }}} |
| 65 | |
| 66 | You would check it in and make the Job record point to it. |
| 67 | ||'''Job Id'''||'''Last Run'''||'''Status'''||'''Next Run'''||'''Configuration'''|| |
| 68 | || || |
| 69 | ||My Job|| 12:45 Today || 13:00 Today || OK || [# http://trac-hacks.org/browser/myjob.py?rev=6077]|| |
| 70 | || || |
| 71 | |
| 72 | |
| 73 | == Recent Changes == |
| 74 | |
| 75 | [[ChangeLog(jobcontrolplugin, 3)]] |
| 76 | |
| 77 | == Author/Contributors == |
| 78 | |
| 79 | '''Author:''' [wiki:thanos] [[BR]] |
| 80 | '''Maintainer:''' [wiki:thanos] [[BR]] |
| 81 | '''Contributors:''' |