| 1 |
.. _text_based_def_using_dependencies_together: |
| 2 |
|
| 3 |
Using dependencies together |
| 4 |
/////////////////////////// |
| 5 |
|
| 6 |
The way a combination of different dependencies work together is not |
| 7 |
always clear. In order for a node to be scheduled: |
| 8 |
|
| 9 |
- **Parent**: must be free in order for its children to run. A family must be free before any of its tasks can run. |
| 10 |
- **Date**: must be free. This is checked when you begin a suite begin(CLI) and at midnight for the suite. There is no midnight for a hybrid clock. |
| 11 |
- **Time**: must be free. This is checked every minute (configurable.) |
| 12 |
- **Trigger**: must be free. This is checked every time there is a state change in the suite for all potential nodes. |
| 13 |
- **Limit**: must not be full. Boolean limits just have slots in them, while integer limits must have enough space for the usage. |
| 14 |
|
| 15 |
Here are a few examples of combinations with their behaviour. |
| 16 |
|
| 17 |
To run task only once, on 17th of February 2012 at 10 am: |
| 18 |
|
| 19 |
.. code-block:: shell |
| 20 |
|
| 21 |
task x |
| 22 |
time 10:00 |
| 23 |
date 17.2.2012 |
| 24 |
|
| 25 |
|
| 26 |
To run task twice, at 10am and 8pm, on both 17th and 19th of February |
| 27 |
2012, that is, four times in all. Notice the task is queued in between, |
| 28 |
and completes only after the last run. Under a hybrid clock, the task is |
| 29 |
run (twice) only if the date is either 17th or 19th at the time the |
| 30 |
suite begins: |
| 31 |
|
| 32 |
.. code-block:: shell |
| 33 |
|
| 34 |
task x |
| 35 |
time 10:00 ; time 20:00 |
| 36 |
date 17.2.2012 ; date 19.2.2012 |
| 37 |
|
| 38 |
To run task after task is complete and if the day is Monday. If the |
| 39 |
suite is using a real clock, the task waits for the following Monday |
| 40 |
(unless today is Monday) and for task to be complete. Under a hybrid |
| 41 |
clock, if today is not Monday when the suite begins or is |
| 42 |
auto-restarted, task is marked complete without being submitted: |
| 43 |
|
| 44 |
.. code-block:: shell |
| 45 |
|
| 46 |
task y |
| 47 |
task x |
| 48 |
trigger ./y == complete |
| 49 |
day monday |
| 50 |
|
| 51 |
|
| 52 |
The next example shows how to run a task after an earlier task has |
| 53 |
stopped, either by completing or aborting. It may be useful to continue |
| 54 |
after a task has tried a few times but still failed. However, this |
| 55 |
technique should only be used if there is logic somewhere to correct for |
| 56 |
the missing task. Otherwise, task **y** will fail as well. |
| 57 |
|
| 58 |
.. code-block:: shell |
| 59 |
|
| 60 |
task x |
| 61 |
task y |
| 62 |
trigger ./x == complete or ./x == aborted |
| 63 |
# |
| 64 |
#The above trigger using named operators: |
| 65 |
# |
| 66 |
# trigger x eq complete or x eq aborted |
| 67 |
# |
| 68 |
task z |
| 69 |
trigger (x==complete or x==aborted) and (y==complete or y==aborted) |
| 70 |
|
| 71 |
To run a task on a series of given days, use the Python API: |
| 72 |
|
| 73 |
.. code-block:: python |
| 74 |
|
| 75 |
t = ecflow.Task("x") |
| 76 |
for i in [ 1 , 2, 4, 8, 16 ] : |
| 77 |
t.add_date(i,0,0) # 0 means any day,month or year |
| 78 |
|
| 79 |
Will be displayed by the show(CLI) command as: |
| 80 |
|
| 81 |
.. code-block:: shell |
| 82 |
|
| 83 |
task x |
| 84 |
date 1.*.* |
| 85 |
date 2.*.* |
| 86 |
date 4.*.* |
| 87 |
|
| 88 |
To run a task half after the previous task fc has done half of its work: |
| 89 |
|
| 90 |
.. code-block:: shell |
| 91 |
|
| 92 |
task fc |
| 93 |
meter hour 0 240 |
| 94 |
task half |
| 95 |
trigger fc:hour >= 120 |
| 96 |
# trigger fc:hour ge 120 |
| 97 |
|
| 98 |
|
| 99 |
There is no guarantee that a task will be sent at the exact moment |
| 100 |
requested. At the specified time, ecFlow might be busy processing other |
| 101 |
tasks. ecFlow does not check time dependencies constantly, but sweeps through them |
| 102 |
once a minute. This makes processing of events in ecFlow much more |
| 103 |
stable. |