Changes between Version 14 and Version 15 of JobControlPlugin


Ignore:
Timestamp:
Apr 5, 2022, 6:10:02 AM (2 years ago)
Author:
figaro
Comment:

Move example to functional description

Legend:

Unmodified
Added
Removed
Modified
  • JobControlPlugin

    v14 v15  
    1010
    1111The plugin lets you set up and manage and monitor scheduled jobs. It adds the following new Admin screens to Trac:
    12  * Job Admin - List and lets you add, edit and delete jobs.
    13  * 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.
     12 * Job Admin - Lists all jobs and lets you add, edit and delete jobs.
     13 * Job Status Map - 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.
    1414 * Run View - Lists all job runs, showing you the runs status form where you can drill down to the runs log.
    1515 * Log Admin - Clean-up logs and other tasks.
     
    2424
    2525[[Image(jobcontrol-jobedit.png)]]
     26
     27Here is an example of a job configuration:
     28{{{#!python
     29from jobcontrolplugin import JobSpec, today
     30
     31from logging import DEBUG
     32
     33class 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
     54MyJob.run()
     55}}}
     56
     57Then 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]||
    2661
    2762== Bugs/Feature Requests
     
    4580This plugin is not yet available for Trac version 0.12 and above.
    4681
    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 
    8482== Recent Changes
    8583