[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |
A cyclical task is a task which is executed more than one time while a day of exploitation. This type of task is defined by the maximal number of iterations and an interval in seconds between two executions. This interval is measured from the begin or from the end of the task.
Each time a cyclical task is executed again, all start conditions are re-evaluated. For example, if a task has a file condition, it will wait for the file presence again.
A `hlate' condition can be used to stop the cycle of the task. The task is canceled.
In this example, we will create a task which is executed 5 times with a temporization of 15 seconds between two executions.
We create a referential `r1' with a task `t1'.
We add an operation to plan the task every days (rtoa
command) :
$ dio87c ra r1 $ dio87c rta r1 t1 $ dio87c rtoa r1 t1 add always |
Finally, we add a job `j1' to the task `t1'. This job execute `/bin/sleep' with `10' as argument :
$ dio87c rja r1 t1 j1 $ dio87c rjsp r1 t1 j1 "/bin/sleep" $ dio87c rjsa r1 t1 j1 "10" |
We are ready now ! We print properties of the task `t1' with the
rti
command :
$ dio87c rti r1 t1 Task Name: t1 Ref Name: r1 Description: Enabled: true Wait All Dependencies: true On Error Continue: true Iterations: 1 Interval: 0 From: begin Lock Variable: none Lock Action: none Target: localhost Queue: batch |
You can see that this task is not cyclical : the `Iterations' property shows that the number of executions is 1, this means that the task will be executed only one time. The `Interval' property, which indicates the time in seconds between two executions is 0 (this property is not used when the number of iterations is 1).
We use the rtsc
command to change the cyclical properties of the
task. The last arguments are the number of iterations, the temporisation
between two executions (in seconds) and an argument which indicates if the
temporisation starts from the begin of the task (`begin') or from the
end of the task (`begin').
In this example, we define with the `rtsc' command that the number of
iterations is 5 and that the temporization is 15. Then, we verify that
changes are made by using the rti
command :
$ dio87c rtsc r1 t1 5 15 end $ $ dio87c rti r1 t1 Task Name: t1 Ref Name: r1 Description: Enabled: true Wait All Dependencies: true On Error Continue: true Iterations: 5 Interval: 15 From: end Lock Variable: none Lock Action: none Target: localhost Queue: batch |
We create a new day `d1' with the rp
command :
$ dio87c rp r1 "2004-10-06" d1 $ |
At once, we check the state of the task `t1' :
$ dio87c xti d1 t1 Task Name: t1 Day Name: d1 [...] Enabled: true Iterations: 5 Interval: 15 From: end Actual Iteration: 1 [...] State: running Start time: 2004-10-06 19:04:22 End time: not terminated |
You can see that the task is running (`state: running'), thate it's its first execution (`Actual Iteration:1'), that it starts at `19:04:22' and that the task is not terminated `End time: not terminated').
After few seconds, we print the state of the task again :
$ dio87c xti d1 t1 Task Name: t1 Day Name: d1 [...] Iterations: 5 Interval: 15 From: end Actual Iteration: 1 [...] State: wait_tempo Start time: 2004-10-06 19:04:22 End time: 2004-10-06 19:04:33 |
The task is waiting for temporization (`State: wait_tempo'). The last execution was terminated at `19:04:33'. After few seconds, the tasks' state changes :
$ dio87c xti d1 t1 Task Name: t1 [...] Iterations: 5 Interval: 15 From: end Actual Iteration: 2 [...] State: running Start time: 2004-10-06 19:04:48 End time: not terminated |
The task is again running (`State: running') and is in the second execution (`Actual Iteration:2'). The start time is `19:04:48' : the temporisation of 15 seconds between two executions was correctly applied (since `19:04:33').
The cycle wait/execution will be reproduced 5 times. Finally, the task will be terminated (`State: terminated') :
$ dio87c xti d1 t1 Task Name: t1 [...] Iterations: 5 Interval: 15 From: end Actual Iteration: 5 [...] State: terminated Start time: 2004-10-06 19:06:03 End time: 2004-10-06 19:06:13 $ |
Now, we will add a manual condition to the task `t1'. We will see that the task is evaluated each time, before execution.
We add a manual condition (with the rtca
command). We create
a new day `d2' (rp
command) :
$ dio87c rtca r1 t1 manual "ready?" $ dio87c rp r1 "2004-10-09" d2 $ |
With the rti
command, we check that the task is waiting for
conditions :
$ dio87c xti d2 t1 Task Name: t1 Day Name: d2 [..] State: wait_for_condition [..] $ |
We validate the condition with the xtcv
command and we check
with the xti
command that the task runs :
$ dio87c xtcv d2 t1 1 $ $ dio87c xti d2 t1 Task Name: t1 [...] Actual Iteration: 1 [...] State: running Start time: 2004-10-09 11:54:23 End time: not terminated $ |
After a few secondes, the first execution of the task is terminated and the task is waiting for temporization (`wait_tempo') :
$ dio87c xti d2 t1 Task Name: t1 [...] State: wait_tempo Start time: 2004-10-09 11:54:23 End time: 2004-10-09 11:54:39 $ |
After 15 seconds, the temporization is terminated and the task is waiting for conditions again :
$ dio87c xti d2 t1 Task Name: t1 [...] Actual Iteration: 2 [...] State: wait_for_condition Start time: not started End time: not terminated $ |
We use the xtcv
command to execute the task again :
$ dio87c xtcv d2 t1 1 $ $ dio87c xti d2 t1 Task Name: t1 [...] Actual Iteration: 2 [...] State: running Start time: 2004-10-09 12:04:48 End time: not terminated $ |
We must use 5 times the xtcv
command : one time per iteration. The
other condition type (like file presence) can be used to control tasks'
start.
A `hlate' condition can be used to stop the cycle before the maximum number of iterations is reached.
In this example, we remove the `manual' condition and we replace it by
an `hlate' condition to stop the cycle before 12:30 (rtca
command). We change the cyclical properties of the task (rtsc
command) to set the maximal number of execution to unlimited.
Finally, we create a third day (`d3') and enable it.
$ dio87c rtck r1 t1 manual "ready?" $ dio87c rtca r1 t1 hlate "12:30" $ dio87c rtsc r1 t1 unlimited 15 end $ |
After a few seconds, we check thtat the task is running and that the maximal number of executions is unlimited (`Iterations: unlimited') :
dio87c xti d3 t1 Task Name: t1 [...] Iterations: unlimited Interval: 14 From: end Actual Iteration: 1 [...] State: wait_tempo Start time: 2004-10-09 12:24:33 End time: 2004-10-09 12:24:48 $ |
At 12:30, we check that the task is terminated :
$ dio87c xti d3 t1 Task Name: t1 [...] Actual Iteration: 15 [...] State: canceled Start time: not started End time: not terminated $ |
You can notice that the task is canceled (`State: canceled') et that it was its fifteenth execution. If the task was in execution at the time of the `hlate' condition, the task terminates normally, then its state change to `canceled'.
[ < ] | [ > ] | [ << ] | [ Up ] | [ >> ] | [Top] | [Contents] | [Index] | [ ? ] |