[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

9.5.3 Task dependencies

In the previous example, we have created dependencies between jobs of the same task. But, you can also create dependencies between tasks of the same referential.

In this example, we will create :

First, you must ensure that the dio87d daemon is running (see section 8.1 Start the deamon).

We create a referential :

 
$ dio87c -- ra ref1
$

We have to create four tasks. Each task has one job.

We create the first task `t1' with the rta command. The rtoa command defines that the task must be executed every days.

 
$ dio87c -- rta ref1 t1 "first task"
$ dio87c -- rtoa ref1 t1 add always
$

Now, we create a job `job1' in this task (rja command) which execute the `/bin/true' command (rja). This command return zero as exit code : it's considered as a normal termination by Diogene87.

 
$ dio87c -- rja ref1 t1 job1
$ dio87c -- rjsp ref1 t1 job1 "/bin/true"
$

We create the second task `t2' by copying `t1' (rtd command) and we change the task description (rjsd command). We change the path of the job to execute the /bin/sleep (rjsp command) with an argument of 30 secondes (rjsa command) :

 
$ dio87c -- rtd ref1 t2
$ dio87c -- rtsd ref1 t2 "if task1 OK"
$ dio87c -- rjsp ref1 t2 job1 "/bin/sleep"
$ dio87c -- rjsa ref1 t2 job1 "30"
$

We create the task `t3' by copying `t2' and we change the task description :

 
$ dio87c -- rtd ref1 t2 t3
$ dio87c -- rtsd ref1 t3 "if t1 is aborted"
$

We create the task `t4' :

 
$ dio87c -- rtd ref1 t2 t4
$ dio87c -- rtsd ref1 task4 "when task2 or task3 is OK"
$

Now, we will create tasks dependencies.

`t2' will start only if `t1' terminates without error. We use the rtda command to create an `onsuccess' dependence between `t1' and `t2' :

 
$ dio87c -- rtda ref1 t1 t2 onsuccess
$

`t3' will start only if `t1' terminates with abort. We will use the rtda command to create an `onerror' dependence between `t1' and `t3' :

 
$ dio87c -- rtda ref1 t1 t3 onerror
$

`t4' will start when `t2' or `t3' terminates with error. We have first to create two `onsuccess' dependencies :

 
$dio87c -- rtda ref1 t2 t4 onsuccess
$dio87c -- rtda ref1 t3 t4 onsuccess

By default, a task waits for all dependencies before to start. With the rti command, you can verify that the field `Wait All Dependencies' is set to true for `t4' :

 
$ dio87c -- rti ref1 t4
Task Name:   t4
[...]
Wait All Dependencies:   true
[...]
$

We set the `Wait All Dependence' property value to false with the rtswad command :

 
$ dio87c -- rtswad ref1 t4 false
$
$ dio87c -- rti ref1 t4
Task Name:   t4
[...]
Wait All Dependencies:   false
[...]
$

`t4' will start when `t2' or `t3' is terminated without error.

We plan our referential with the rp command to create a new day `d1' :

 
$ dio87c -- rp ref1 "2005-01-20" d1
New day name : d1
from referential : ref1
start time : 2005-01-20 00:00:00
[...]
Termination
$

The task `t1' run and terminates immediatly. It return zero as exit code, which is considered as a normal termination by Diogene87.

The task `t2' starts (`onsuccess' dependence) and the task `t3' is canceled (`onerror' dependence). `t4' is waiting for the `t3' termination.

 
$ dio87c -- xtl d1 -s
t1	terminated
t2	running
t3	canceled
t4	wait_for_dep
$

When `t2' is terminated, `t4' starts :

 
$ dio87c -- xtl d1 -s
t1	terminated
t2	terminated
t3	canceled
t4	running
$

After few seconds, `t4' is terminated.

 
$ dio87c -- xtl d1 -s
t1	terminated
t2	terminated
t3	canceled
t4	terminated
$

To simulate an abort of the task `t1', we replace the path of the command `/bin/true' by `/bin/false'. This command return a non-zero exit code which is interpreted as an error by Diogene87.

 
$ dio87c -- rjsp ref1 t1 job1 "/bin/false"
$

We plan our referential to create a new day `d2' :

 
$ dio87c -- rp ref1 "2005-01-20" d2
New day name : d2
from referential : ref1
start time : 2005-01-20 00:00:00
[...]
Termination
$

The task `t1' run and terminates immediatly. It return a non-zero exit code, which is considered as a abnormal termination by Diogene87.

The task `t3' starts (`onerror' dependence) and the task `t2' is canceled (`onsuccess' dependence). `t4' is waiting for the `t2' termination.

 
$ dio87c -- xtl d2 -s
t1	aborted
t2	canceled
t3	running
t4	wait_for_dep
$

After a few seconds, `t3' is terminated and `t4' starts :

 
$ dio87c -- xtl d2 -s
t1	aborted
t2	canceled
t3	terminated
t4	running
$

Finally, `t4' terminates :

 
$ dio87c -- xtl d2 -s
t1	aborted
t2	canceled
t3	terminated
t4	terminated
$


[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

This document was generated by dom on September, 11 2005 using texi2html