|
| 1 | +Config file type - YML |
| 2 | +---------------------- |
| 3 | +.. warning:: |
| 4 | + This chapter only describes rationale, but is nothing to decide about config file type. Whether later it will go with YML/JSON, it's future discussion and we shall not focus on it during review. |
| 5 | + |
| 6 | +============ |
| 7 | +Rationale |
| 8 | +============ |
| 9 | +YAML is more user-friendly than JSON for manual editing and reading. It supports various features, including labels and references, which aid in the reduction of redundant entries, resulting in a more concise, overall file structure. |
| 10 | +Furthermore, YAML is fully compatible with JSON and can be converted into JSON format without any significant effort, if needed. |
| 11 | + |
| 12 | +Config file schema |
| 13 | +------------------- |
| 14 | + |
| 15 | +.. code-block:: yml |
| 16 | + activities: # Define activities in the application |
| 17 | + GetData: &GetData_label |
| 18 | + whatever_property: 1 # Example how additional properties for the activities can be provided later on |
| 19 | + RunConcurrent1: &RunConcurrent1_label |
| 20 | + prop1: 2 |
| 21 | + RunConcurrent2: &RunConcurrent2_label |
| 22 | + prop1: 1 |
| 23 | + RunSync: &RunSync_label |
| 24 | + prop1: 3 |
| 25 | +
|
| 26 | + state: # Define any states needed for the switch action |
| 27 | + state1: &state1_label |
| 28 | + intitial_value: 1 |
| 29 | +
|
| 30 | + events: 3 Define events if needed |
| 31 | + event1: &event1_label |
| 32 | +
|
| 33 | + # Each flow is a Tree ! |
| 34 | + # We assume that each flow is executed as a loop, running sequentially from the top to the bottom, unless it is shut down. |
| 35 | + flows: |
| 36 | + flow_name1: # Flow declaration |
| 37 | + some_other_prop: whatever # Example how any new properties can be added to flow later |
| 38 | + actions: |
| 39 | + - class: execute |
| 40 | + activity: *GetData_label |
| 41 | + - class: concurrent |
| 42 | + actions: |
| 43 | + - class: execute |
| 44 | + activity: *RunConcurrent1_label |
| 45 | + - class: execute |
| 46 | + activity: *RunConcurrent2_label |
| 47 | + - class: sequence |
| 48 | + actions: |
| 49 | + - class: execute |
| 50 | + activity: *RunConcurrent1_label |
| 51 | + - class: execute |
| 52 | + activity: *RunConcurrent2_label |
| 53 | + - class: trigger |
| 54 | + event: *event1_label |
| 55 | + - class: execute |
| 56 | + activity: *RunSync_label |
| 57 | + - class: switch |
| 58 | + state: *state1_label |
| 59 | + default_action: # optional |
| 60 | + class: execute |
| 61 | + activity: *RunConcurrent2_label |
| 62 | + cases: |
| 63 | + - state_value: 0 |
| 64 | + action: |
| 65 | + class: sequence |
| 66 | + actions: |
| 67 | + - class: execute |
| 68 | + activity: *RunConcurrent2_label |
| 69 | + - state_value: 2 |
| 70 | + action: |
| 71 | + class: execute |
| 72 | + activity: *RunConcurrent2_label |
| 73 | +
|
| 74 | + ## Included here for now to help understand what kinds of flow items are available. |
| 75 | + documentation_node: |
| 76 | + class: |
| 77 | + - sequence # organize activities to be called one after another |
| 78 | + - execute # activity execution, in particular calling Step() |
| 79 | + - concurrent # organize activities to be called concurrently |
| 80 | + - switch # execute activities based on a state |
| 81 | + - synchronize # wait for an event to continue |
| 82 | + - trigger # trigger and event |
| 83 | +
|
| 84 | +
|
| 85 | +Example |
| 86 | +----------- |
| 87 | +Below simple example to illustrate modeled flow in design configuration file. |
| 88 | + |
| 89 | +============ |
| 90 | +Flow description |
| 91 | +============ |
| 92 | + |
| 93 | +.. image:: images/config_example.drawio.svg |
| 94 | + |
| 95 | +============ |
| 96 | +Config |
| 97 | +============ |
| 98 | +.. code-block:: yml |
| 99 | + activities: # Define activities in the application |
| 100 | + Activity1: &Activity1_label |
| 101 | + Activity2: &Activity2_label |
| 102 | + Activity3: &Activity3_label |
| 103 | + Activity4: &Activity4_label |
| 104 | + Activity5: &Activity5_label |
| 105 | + Activity6: &Activity6_label |
| 106 | + Activity7: &Activity7_label |
| 107 | + Activity8: &Activity8_label |
| 108 | + flows: |
| 109 | + app_flow: |
| 110 | + actions: # PICTURE_1_TAG |
| 111 | + - class: execute |
| 112 | + activity: *Activity1_label |
| 113 | + - class: concurrent # PICTURE_2_TAG |
| 114 | + actions: |
| 115 | + - class: sequence # PICTURE_3_TAG |
| 116 | + actions: |
| 117 | + - class: execute |
| 118 | + activity: *Activity2_label |
| 119 | + - class: execute |
| 120 | + activity: *Activity4_label |
| 121 | + - class: sequence # PICTURE_4_TAG |
| 122 | + actions: |
| 123 | + - class: execute |
| 124 | + activity: *Activity3_label |
| 125 | + - class: execute |
| 126 | + activity: *Activity5_label |
| 127 | + - class: concurrent |
| 128 | + actions: |
| 129 | + - class: execute |
| 130 | + activity: *Activity6_label |
| 131 | + - class: execute |
| 132 | + activity: *Activity7_label |
| 133 | + - class: execute |
| 134 | + activity: *Activity8_label |
| 135 | +
|
| 136 | +
|
| 137 | +To be done |
| 138 | +----------- |
| 139 | +When conclusion is reached, still to be done: |
| 140 | + |
| 141 | +- schema (for sake of correct understanding in future) |
| 142 | +- additional docs for config fields/sections |
0 commit comments