| 1 |
.. _text_based_def_aviso: |
| 2 |
|
| 3 |
aviso |
| 4 |
///// |
| 5 |
|
| 6 |
This defines an :term:`aviso` attribute, and thus a node dependency on an Aviso |
| 7 |
notification. The options defining the attribute can be provided in any order. |
| 8 |
|
| 9 |
.. code-block:: shell |
| 10 |
|
| 11 |
task t1 |
| 12 |
aviso --name A --listener '{ ... }' --url http://aviso.ecmwf.int/ --schema /path/to/schema.json --polling 300 --auth /path/to/auth.json |
| 13 |
|
| 14 |
task t2 |
| 15 |
aviso --name B --listener '{ ... }' |
| 16 |
# when not provided, the following default options are used |
| 17 |
# --url %ECF_AVISO_URL% |
| 18 |
# --schema %ECF_AVISO_SCHEMA% |
| 19 |
# --auth %ECF_AVISO_AUTH% |
| 20 |
# --polling %ECF_AVISO_POLLING% |
| 21 |
|
| 22 |
.. note:: |
| 23 |
|
| 24 |
The `listener` parameter is expected to be a valid single line JSON string, enclosed in single quotes. |
| 25 |
|
| 26 |
The listener must define two fields (as per the `Aviso Listerner <https://pyaviso.readthedocs.io/en/latest/guide/define_my_listener.html>`_ definition): |
| 27 |
|
| 28 |
- :code:`event`, specifies the type of Aviso event |
| 29 |
- :code:`request`, specifies a dictionary with the parameters used to check for matches of Aviso notifications |
| 30 |
|
| 31 |
The following are some examples: |
| 32 |
|
| 33 |
.. code-block:: shell |
| 34 |
|
| 35 |
'{ "event": "dissemination", "request": { "destination": "abc" } }' |
| 36 |
|
| 37 |
'{ "event": "mars", "request": { "class": "od", "expver": "0001", "domain": "g", "stream": "abcd", "step": 0 } }' |
| 38 |
|
| 39 |
The Authentication credentials, provided via option :code:`--auth`, are |
| 40 |
provided in a `JSON` file with the content following the |
| 41 |
`ECMWF Web API <https://www.ecmwf.int/en/computing/software/ecmwf-web-api>`_ |
| 42 |
(this is conventionally stored in a file located at `$HOME/.ecmwfapirc`): |
| 43 |
|
| 44 |
.. code-block:: json |
| 45 |
|
| 46 |
{ |
| 47 |
"url" : "https://api.ecmwf.int/v1", |
| 48 |
"key" : "<your-api-key>", |
| 49 |
"email" : "<your-email>" |
| 50 |
} |
| 51 |
|
| 52 |
The Aviso schema file is a JSON file that defines the event listener schema. This is used by |
| 53 |
both Aviso server and client (thus, by ecFlow) to define the valid event types and request |
| 54 |
parameters used when polling for notifications. The schema file path must be provided to the |
| 55 |
`--schema` option (or via the `ECF_AVISO_SCHEMA` variable). |