| 26 | |
| 27 | Here is an example of a job configuration: |
| 28 | {{{#!python |
| 29 | from jobcontrolplugin import JobSpec, today |
| 30 | |
| 31 | from logging import DEBUG |
| 32 | |
| 33 | class MyJob(JobSpec): |
| 34 | """ |
| 35 | Run this script with logging in debug mode. |
| 36 | Run every 45 minutes. |
| 37 | Run /usr/local/etc/myscript at yesterday's date as a command argument. |
| 38 | """ |
| 39 | grouping = "/All Jobs/Tests" |
| 40 | log_level = DEBUG |
| 41 | cron = "* * * 45"; |
| 42 | cmd = "/usr/local/etc/myscript --date=%s"; % today(-1) |
| 43 | run = "runA, runB"; |
| 44 | |
| 45 | def setUp(self): |
| 46 | pass |
| 47 | def tearDown(self): |
| 48 | pass |
| 49 | def runA(self): pass |
| 50 | |
| 51 | @dependsOn(runA) |
| 52 | def runB(self): pass |
| 53 | |
| 54 | MyJob.run() |
| 55 | }}} |
| 56 | |
| 57 | Then check it in and make the Job record point to it: |
| 58 | |
| 59 | ||'''Job Id'''||'''Last Run'''||'''Status'''||'''Next Run'''||'''Configuration'''|| |
| 60 | ||My Job|| 12:45 Today || 13:00 Today || OK || [# http://trac-hacks.org/browser/myjob.py?rev=6077]|| |
47 | | == Example |
48 | | |
49 | | Here is an example of a job configuration: |
50 | | {{{#!python |
51 | | from jobcontrolplugin import JobSpec, today |
52 | | |
53 | | from logging import DEBUG |
54 | | |
55 | | class MyJob(JobSpec): |
56 | | """ |
57 | | Run this script with logging in debug mode. |
58 | | Run every 45 minutes. |
59 | | Run /usr/local/etc/myscript at yesterday's date as a command argument. |
60 | | """ |
61 | | grouping="/All Jobs/Tests" |
62 | | log_level=DEBUG |
63 | | cron="* * * 45"; |
64 | | cmd ="/usr/local/etc/myscript --date=%s"; % today(-1) |
65 | | run= "runA, runB"; |
66 | | |
67 | | def setUp(self): |
68 | | pass |
69 | | def tearDown(self): |
70 | | pass |
71 | | def runA(self): pass |
72 | | |
73 | | @dependsOn(runA) |
74 | | def runB(self): pass |
75 | | |
76 | | MyJob.run() |
77 | | }}} |
78 | | |
79 | | You would check it in and make the Job record point to it: |
80 | | |
81 | | ||'''Job Id'''||'''Last Run'''||'''Status'''||'''Next Run'''||'''Configuration'''|| |
82 | | ||My Job|| 12:45 Today || 13:00 Today || OK || [# http://trac-hacks.org/browser/myjob.py?rev=6077]|| |
83 | | |