Warning: Can't synchronize with repository "(default)" (Unsupported version control system "svn": No module named svn). Look in the Trac log for more information.

Ticket #2474: cron-doc.patch

File cron-doc.patch, 2.7 KB (added by bochecha, 20 months ago)

imprved docstring

  • tgscheduler/kronos.py

     
    557557 
    558558 
    559559class CronLikeTask(Task): 
    560     """A class that is scheduled with a cron-like syntax. 
    561560    """ 
     561    A task that is scheduled based on a cron-like string. 
     562     
     563    A Cron string is composed of **five** time and date fields,  
     564    **separated by spaces**. 
     565     
     566    Note: Tasks are executed when **all** the time and date fields match 
     567    the current time. This is an important difference with the UNIX Cron. 
     568     
     569    The time and date fields are: 
     570 
     571    =============  ================================== 
     572        field                allowed values 
     573    =============  ================================== 
     574    minute         0-59 
     575    hour           0-23 
     576    day of month   1-31 
     577    month          1-12 (or names, see below) 
     578    day of week    0-7 (0 or 7 is Sun, or use names) 
     579    =============  ================================== 
     580 
     581    A field may be an **asterisk** (``*``), which always stands for 
     582    *first-last*. 
     583 
     584    **Ranges** of numbers are allowed. Ranges are two numbers separated with 
     585    a hyphen. The specified range is inclusive. For example, ``8-11`` for 
     586    an "hours" entry specifies *execution at hours 8, 9, 10 and 11*. 
     587 
     588    **Lists** are allowed. A list is a set of numbers (or ranges) separated 
     589    by commas. Examples: ``1,2,5,9``, ``0-4,8-12``. 
     590 
     591    **Step values** can be used in conjunction with ranges. Following a 
     592    range with  ``/<number>`` specifies skips of the number's value through 
     593    the range. For example,``0-23/2`` can be used in the "hours" field to 
     594    specify task execution *every other hour* (the alternative in the V7 
     595    standard is ``0,2,4,6,8,10,12,14,16,18,20,22``). Steps are also 
     596    permitted after an asterisk, so if you want to say *every two hours*, 
     597    just use ``*/2``. 
     598 
     599    **Names** can also be used for the "month" and "day of week" fields. Use 
     600    the first three letters of the particular day or month (case doesn't 
     601    matter). Ranges of mixed names and integer are not permitted. 
     602    """ 
    562603    def __init__(self, name, action, cron_str, args=None, kw=None): 
     604        """Initializes the task.""" 
    563605        Task.__init__(self, name, action, args, kw) 
    564606 
    565607        self.cron_str = cron_str 
     
    588630    def __process_str(self, time_str, bounds, mapping=None): 
    589631        """Transforms a field of the cron-like string into a list 
    590632 
    591         Note: specifying a range as a mix of integers and names 
    592               (months and dows) is NOT supported 
    593  
    594633        @param time_str: a field in the cron-like string 
    595634        @type time_str: string 
    596635