File: Cron.rst

package info (click to toggle)
ecflow 5.15.2-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 51,868 kB
  • sloc: cpp: 269,341; python: 22,756; sh: 3,609; perl: 770; xml: 333; f90: 204; ansic: 141; makefile: 70
file content (153 lines) | stat: -rw-r--r-- 4,332 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
ecflow.Cron
///////////


.. py:class:: Cron
   :module: ecflow

   Bases: :py:class:`~Boost.Python.instance`

A :term:`cron` defines a repeating time dependency for a node.


Constructor::

   Cron()
   Cron(string time_series,
        days_of_week=list of ints,   # 0-6, Sunday-Saturday
        days_of_month=list of ints,  # 1-31
        months=list of ints)         # 1-12
   Cron(TimeSeries time_series,
        days_of_week=list of ints,
        days_of_month=list of ints,
        months=list of ints)

Exceptions:

- raises IndexError || RuntimeError when an invalid cron is specified

Usage (see the :ref:`cron definition<text_based_def_cron>` for more examples):

.. code-block:: python

    # Run every day at 2pm
    cron = Cron('14:00')

    # Run every 30 minutes between 0:00 and 20:00, the first 6 days of the month from January until July
    cron = Cron('+00:00 20:00 00:30', days_of_month=[1,2,3,4,5,6], months=[1,2,3,4,5,6])

    # Run relative to suite start time or task requeue time
    cron = Cron('+01:30',days_of_week=[0,1,2,3,4,5,6])

    # Run relative to suite start time or task requeue time
    cron = Cron('+00:15 23:00 00:30', days_of_week=[0,1,2],days_of_month=[4,5,6], months=[1,2,3])

    # Define Cron based on start/end/increment
    start = TimeSlot(0 , 0)
    finish = TimeSlot(23, 0)
    incr = TimeSlot(0, 30)
    ts = TimeSeries(start, finish, incr, True)  # True means relative to suite start
    cron = Cron(ts, days_of_week=[0,1,2,3,4,5,6],days_of_month=[1,2,3,4,5,6], months=[1,2])

    # Use Cron methods to set weekdays, days of month and month parameters
    cron = Cron()
    cron.set_week_days([0, 1, 2, 3, 4, 5, 6])
    cron.set_days_of_month([1, 2, 3, 4, 5, 6 ])
    cron.set_months([1, 2, 3, 4, 5, 6])
    cron.set_time_series(ts)

    # Use Cron methods to set time series
    cron = Cron()
    cron.set_time_series(1, 30, True)  # same as cron +01:30

    # Use Cron methods to set time series over all days of the week
    cron = Cron()
    cron.set_week_days([0, 1, 2, 3, 4, 5, 6])
    cron.set_time_series('00:30 01:30 00:01')

    # Use Cron methods to set relative time series over all days of the week
    cron = Cron()
    cron.set_week_days([0, 1, 2, 3, 4, 5, 6])
    cron.set_time_series('+00:30')


.. py:property:: Cron.days_of_month
   :module: ecflow

returns a integer list of days of the month


.. py:method:: Cron.last_day_of_the_month( (Cron)arg1) -> bool :
   :module: ecflow

Return true if last day of month is enabled


.. py:property:: Cron.last_week_days_of_the_month
   :module: ecflow

returns a integer list of last week days of the month


.. py:property:: Cron.months
   :module: ecflow

returns a integer list of months of the year


.. py:method:: Cron.set_days_of_month( (Cron)arg1, (list)arg2) -> None :
   :module: ecflow

Specifies days of the month. Expects a list of integers with integer range 1-31


.. py:method:: Cron.set_last_day_of_the_month( (Cron)arg1) -> None :
   :module: ecflow

Set cron for the last day of the month


.. py:method:: Cron.set_last_week_days_of_the_month( (Cron)arg1, (list)arg2) -> None :
   :module: ecflow

Specifies last week days of the month. Expects a list of integers, with integer range 0==Sun to 6==Sat


.. py:method:: Cron.set_months( (Cron)arg1, (list)arg2) -> None :
   :module: ecflow

Specifies months. Expects a list of integers, with integer range 1-12


.. py:method:: Cron.set_time_series( (Cron)arg1, (int)hour, (int)minute [, (bool)relative=False]) -> None :
   :module: ecflow

time_series(hour(int),minute(int),relative to suite start(bool=false)), Add a time slot

set_time_series( (Cron)arg1, (TimeSeries)arg2) -> None :
    Add a time series. This will never complete

set_time_series( (Cron)arg1, (TimeSlot)arg2, (TimeSlot)arg3, (TimeSlot)arg4) -> None :
    Add a time series. This will never complete

set_time_series( (Cron)arg1, (str)arg2) -> None :
    Add a time series. This will never complete


.. py:method:: Cron.set_week_days( (Cron)arg1, (list)arg2) -> None :
   :module: ecflow

Specifies days of week. Expects a list of integers, with integer range 0==Sun to 6==Sat


.. py:method:: Cron.time( (Cron)arg1) -> TimeSeries :
   :module: ecflow

return cron time as a TimeSeries


.. py:property:: Cron.week_days
   :module: ecflow

returns a integer list of week days