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
|
.. index:: single: cookbook-acquisition_task_pattern
.. _cookbook-acquisition_task_pattern:
Acquisition task pattern example
********************************
An acquisition task may be needed to initiate the processing. The
following example shows such a pattern where a wait task is created to
check the presence of input data in the acquisition time window 10:00 to 12:00. A
task is dedicated to raise a red alarm, by 11:00, if data are not yet
arrived, to have operators and analysts aware in advance and careful about this. **wait**
task runs every 5 minutes and set the **data event** when input data are
found ; it shall sleep 60 seconds, after setting the event, before completing, to ensure
the server receives the event and starts the data task, before wait task
completion and immediate requeue, thanks to cron. **data task** (validation and
preprocessing) will then set the **ready event** and **acq family** will
become complete, provided underneath tasks are complete or queued, so that **rt/wait**
and **late_alert** do not run any further.
.. image:: /_static/cookbook/check_file.png
.. code-block:: shell
family acq
complete acq/data eq complete
task data
trigger rt/wait:data
event ready
family rt
complete data:ready
task wait
event data
cron 10:00 12:00 00:05
endfamily
task late_alter
trigger not data:ready
time 11:00
endfamily
In some situation, we may want the acquisition family to detect if
data are already available (catchup mode), and start the processing
immediately, before reaching the real-time mode, when the wait task is
submitted regularly to check data arrival during the time interval.
.. image:: /_static/cookbook/check_rtnrt.png
.. code-block:: shell
family acquisition
complete acq/data eq complete
family rt
complete data:ready or nrt eq complete
task wait
event data
cron 10:00 12:00 00:05
endfamily
task late
trigger not data:ready
time 11:00
family nrt
complete data:ready
task wait
event data
endfamily
task data
trigger rt/wait:data or nrt/wait:data
event ready
endfamily
|