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

9.5.1 A dependence between two jobs

In this sample, we will send two jobs. The second job will wait the end of the first job before starting.

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

We must create a referential `ref1', which is a sort of template, where all tasks and jobs are created.

 
$ dio87c -- ra ref1
$

Now, we create a task to store our two jobs. A task is a group of jobs which are running on the same computer at the same period. When a task is planned, all jobs of the task are planned.

We create a task `t1' (with the rta command). We use the rti command to print informations for the task.

 
$ dio87c -- rta ref1 t1 
$ dio87c -- rtl ref1
t1
$
$ dio87c -- rti ref1 t1
Task Name:      t1
Ref Name:       ref1
[...]
$

We use the rtoa command to specify that the task must be executed every days.

 
$ dio87c -- rtoa ref1 t1 add always
$

Now, we can create two jobs in the task `t1' of the referential `ref1'.

We use the rja command to create the first job `job1' in the task `t1'. This job will execute the /bin/sleep with an argument of 30 seconds. We use the `rjsp' command to set the path of the command to execute and the `rjsa' command to set the argument to pass.

 
$ dio87c -- rja ref1 t1 job1
$ dio87c -- rjsp ref1 t1 job1 "/bin/sleep" 
$ dio87c -- rjsa ref1 t1 job1 30
$
$ dio87c -- rji ref1 t1 job1
Job Name:       job1
Task Name:      t1
Ref Name:       ref1
[...]
Task Target:    localhost
Target Queue:   batch
Path:           /bin/sleep
Argument:       30
[...]
$

We do the same thing for the job `job2' :

 
$ dio87c -- rja ref1 t1 job2
$ dio87c -- rjsp ref1 t1 job2 "/bin/sleep" 
$ dio87c -- rjsa ref1 t1 job2 30

Now, we must create a dependence between `job1' and `job2'. With a job dependence, the downstream job will wait until the upstream job termination. before to start. There are three type of dependencies : `onerror', `onsuccess' and `always'.

We use the rjda command to create a dependence between `job1' and `job2'. The rjdl is used to print the dependence list of the task :

 
$ dio87c -- rjda ref1 t1 job1 job2 
$
$ dio87c -- rjdl ref1 t1 
job1     job2
$

The referential is now ready. We must plan a new day with the rp command. The parameters of this command are the name of the referential to plan and the start time of the new day. In this example, you must use the date of the current day. The third parameter, which is optional, is the name of the day to create (`d1') : if this paramater is not specified, the name of the new day is composed of the referential name followed by the start time (`YYYY-MM-DD'.

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

A new day has been planned in `dio87d'. You can print the day list with the xdl command :

 
$ dio87c -- xdl
d1
$

All tasks, jobs and dependencies were copied from the referential. You can use the xtl to see the task list and the xjl command to see the job list.

With the xjl command, you can see that `job1' is now running, and `job2' is waiting for dependence :

 
$ dio87c -- xjl -s d1 t1 
job1	running
job2	wait_for_dep
$
$ dio87c -- xtl -s d1
t1      running
$

After a few seconds, `job1' is terminated and `job2' is running :

 
$ dio87c -- xjl -s d1 t1
job1	terminated
job2	running
$
$ dio87c -- xtl -s d1
t1      running
$

Finally, after a few seconds, `job2' is terminated. The task is now terminated.

 
$ dio87c -- xjl -s d1 t1 
job1	terminated
job2	terminated
$
$ dio87c -- xtl -s d1
t1      terminated
$


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

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