Skip to content

Commit

Permalink
[config] Introduction of YAML format for eCAL configuration (#1669)
Browse files Browse the repository at this point in the history
* Changed runtime configuration format from ini to yaml
* Implementation of yaml reader
* Removing the simple-ini dependency + implementation from core
* Implementation of defaults via yaml reading
  • Loading branch information
Peguen authored Jul 26, 2024
1 parent 9b5f082 commit 0d361d0
Show file tree
Hide file tree
Showing 101 changed files with 2,841 additions and 1,869 deletions.
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/bug_report.yml
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ body:
Platform : x64
------------------------- CONFIGURATION --------------------------
Default INI : C:\ProgramData\eCAL\ecal.ini
Default YAML : C:\ProgramData\eCAL\ecal.yaml
------------------------- NETWORK --------------------------------
Host name : FRLBJRXW
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-macos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ jobs:
-DPython_FIND_STRATEGY=LOCATION \
-DPython_FIND_REGISTRY=NEVER
sudo mkdir /etc/ecal
sudo cp "$GITHUB_WORKSPACE/ecal/core/cfg/ecal.ini" /etc/ecal
sudo cp "$GITHUB_WORKSPACE/ecal/core/cfg/ecal.yaml" /etc/ecal
shell: bash

- name: Build Release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-ubuntu.yml
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON \
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON \
-DECAL_THIRDPARTY_BUILD_QWT=ON \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=OFF \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_PREFIX=/usr \
Expand All @@ -144,7 +144,7 @@ jobs:
-DPython_FIND_VIRTUALENV=ONLY
sudo mkdir /etc/ecal
sudo cp "$GITHUB_WORKSPACE/ecal/core/cfg/ecal.ini" /etc/ecal
sudo cp "$GITHUB_WORKSPACE/ecal/core/cfg/ecal.yaml" /etc/ecal
shell: bash

- name: Build Release
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/build-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^
-DECAL_THIRDPARTY_BUILD_QWT=OFF ^
-DECAL_THIRDPARTY_BUILD_YAML-CPP=OFF ^
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON ^
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_PREFIX_PATH="%ProgramFiles%/Cap'n Proto/lib/cmake/CapnProto" ^
Expand Down Expand Up @@ -138,7 +138,7 @@ jobs:
-DCMAKE_BUILD_TYPE=Release ^
-DCPACK_PACK_WITH_INNOSETUP=ON
mkdir "%ALLUSERSPROFILE%\eCAL"
copy "%GITHUB_WORKSPACE%\ecal\core\cfg\ecal.ini" "%ALLUSERSPROFILE%\eCAL"
copy "%GITHUB_WORKSPACE%\ecal\core\cfg\ecal.yaml" "%ALLUSERSPROFILE%\eCAL"
shell: cmd

- name: Build SDK
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/clang-tidy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON \
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON \
-DECAL_THIRDPARTY_BUILD_QWT=OFF \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=OFF \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_PREFIX=/usr \
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/documentation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ jobs:
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON \
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON \
-DECAL_THIRDPARTY_BUILD_QWT=OFF \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=OFF \
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_SYSCONFDIR=/etc \
-DCMAKE_INSTALL_PREFIX=/usr \
Expand Down
2 changes: 1 addition & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ option(ECAL_USE_CLOCKLOCK_MUTEX "Use native mutex with monotonic
set(ECAL_CORE_HAS_PROTOBUF ON)
set(ECAL_CORE_BUILD_SAMPLES ${BUILD_SAMPLES})
set(ECAL_CORE_BUILD_TESTS ${BUILD_ECAL_TESTS})
set(ECAL_CORE_CONFIG_INIFILE ON)
set(ECAL_CORE_CONFIGURATION ON)
set(ECAL_CORE_COMMAND_LINE ON)
set(ECAL_CORE_REGISTRATION ON)
set(ECAL_CORE_MONITORING ON)
Expand Down
4 changes: 2 additions & 2 deletions CMakePresets.json
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@
"ECAL_THIRDPARTY_BUILD_SPDLOG": "OFF",
"ECAL_THIRDPARTY_BUILD_TERMCOLOR": "OFF",
"ECAL_THIRDPARTY_BUILD_TINYXML2": "OFF",
"ECAL_THIRDPARTY_BUILD_YAML-CPP": "OFF",
"ECAL_THIRDPARTY_BUILD_YAML-CPP": "ON",
"ECAL_THIRDPARTY_BUILD_CURL": "OFF",
"ECAL_THIRDPARTY_BUILD_HDF5": "OFF"
}
Expand Down Expand Up @@ -98,7 +98,7 @@
"ECAL_THIRDPARTY_BUILD_SPDLOG": "ON",
"ECAL_THIRDPARTY_BUILD_TERMCOLOR": "ON",
"ECAL_THIRDPARTY_BUILD_TINYXML2": "ON",
"ECAL_THIRDPARTY_BUILD_YAML-CPP": null,
"ECAL_THIRDPARTY_BUILD_YAML-CPP": "ON",
"ECAL_THIRDPARTY_BUILD_CURL": null,
"ECAL_THIRDPARTY_BUILD_HDF5": null
}
Expand Down
6 changes: 3 additions & 3 deletions app/mon/mon_gui/src/ecalmon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,21 +102,21 @@ Ecalmon::Ecalmon(QWidget *parent)

if (multicast_ttl <= 0)
{
network_mode_widget_->setToolTip("ERROR: Network enabled but TTL is " + QString::number(multicast_ttl) + ". Change via ecal.ini");
network_mode_widget_->setToolTip("ERROR: Network enabled but TTL is " + QString::number(multicast_ttl) + ". Change via ecal.yaml");
network_mode_widget_->setStyleSheet("background-color: rgb(255, 128, 128); color: black");
network_mode_warning_icon_->setVisible(true);
}
else
{
network_mode_widget_->setStyleSheet("background-color: rgb(80, 255, 120); color: black");
network_mode_widget_->setToolTip("Change via ecal.ini");
network_mode_widget_->setToolTip("Change via ecal.yaml");
}
}
else
{
network_mode_label_->setText("Network mode: Local");
network_mode_widget_->setStyleSheet("background-color: rgb(44, 148, 255); color: black");
network_mode_widget_->setToolTip("Change via ecal.ini");
network_mode_widget_->setToolTip("Change via ecal.yaml");
}

error_label_ = new QLabel(this);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -192,11 +192,11 @@ void TopicWidget::loadRegExpLists()
include_string = QString::fromStdString(eCAL::Config::GetMonitoringFilterIncludeList()); //ini.GetValue(MON_SECTION_S, MON_FILTER_INCL_S);


// The ecal.ini defines a very strange regex format: A filter consists of
// The ecal.yaml defines a very strange regex format: A filter consists of
// several regular expressions divided by "," or ";". Thus we have to
// split the string into 'actual' regular expressions. This will break every
// regular expression that properly uses a ",". We cannot do anything about
// that without changing the ecal.ini specification.
// that without changing the ecal.yaml specification.
#if QT_VERSION >= QT_VERSION_CHECK(5, 14, 0)
QList<QString> const exclude_string_list = exclude_string.split(QRegularExpression("[\\,,;]"), Qt::SplitBehaviorFlags::SkipEmptyParts);
QList<QString> const include_string_list = include_string.split(QRegularExpression("[\\,,;]"), Qt::SplitBehaviorFlags::SkipEmptyParts);
Expand Down
14 changes: 7 additions & 7 deletions app/rec/rec_client_core/src/job/record_job.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@ namespace eCAL
}
}

// Copy ecal.ini
// Copy ecal.yaml
#ifdef CopyFile
#define CopyFile_6376c040f4f54106b205ef6ddbb2090a CopyFile
#undef CopyFile
Expand All @@ -174,28 +174,28 @@ namespace eCAL

if (ecal_ini_original_path.empty())
{
const std::string error_message = "Error copying ecal.ini: The system information does not contain \"Default INI\" identifier.";
const std::string error_message = "Error copying ecal.yaml: The system information does not contain \"Default INI\" identifier.";
info_ = { false, error_message };
EcalRecLogger::Instance()->error(error_message);
}

if (EcalUtils::Filesystem::IsFile(ecal_ini_original_path))
{
std::string ecal_ini_dest_path = EcalUtils::Filesystem::ToNativeSeperators(hostname_dir + "/ecal.ini");
EcalRecLogger::Instance()->info("Copying ecal.ini from \"" + ecal_ini_original_path + "\" to \"" + ecal_ini_dest_path + "\"");
std::string ecal_ini_dest_path = EcalUtils::Filesystem::ToNativeSeperators(hostname_dir + "/ecal.yaml");
EcalRecLogger::Instance()->info("Copying ecal.yaml from \"" + ecal_ini_original_path + "\" to \"" + ecal_ini_dest_path + "\"");

if (!EcalUtils::Filesystem::CopyFile(ecal_ini_original_path, ecal_ini_dest_path, EcalUtils::Filesystem::OsStyle::Current))
{
const std::string error_message = "Error copying ecal.ini file to \"" + ecal_ini_dest_path + "\"";
const std::string error_message = "Error copying ecal.yaml file to \"" + ecal_ini_dest_path + "\"";
info_ = { false, error_message };
EcalRecLogger::Instance()->error(error_message);
}
}
else
{
const std::string error_message = "Warning: ecal.ini does not exist and will not be copied.";
const std::string error_message = "Warning: ecal.yaml does not exist and will not be copied.";
info_ = { false, error_message };
EcalRecLogger::Instance()->warn("Warning: ecal.ini does not exist and will not be copied.");
EcalRecLogger::Instance()->warn("Warning: ecal.yaml does not exist and will not be copied.");
}
}
#ifdef CopyFile_6376c040f4f54106b205ef6ddbb2090a
Expand Down
2 changes: 1 addition & 1 deletion build_win/win_make_cmake.bat
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ set CMAKE_OPTIONS_SDK=-DCMAKE_INSTALL_PREFIX=_install ^
-DECAL_THIRDPARTY_BUILD_RECYCLE=ON ^
-DECAL_THIRDPARTY_BUILD_TCP_PUBSUB=ON ^
-DECAL_THIRDPARTY_BUILD_QWT=OFF ^
-DECAL_THIRDPARTY_BUILD_YAML-CPP=OFF ^
-DECAL_THIRDPARTY_BUILD_YAML-CPP=ON ^
-DECAL_THIRDPARTY_BUILD_UDPCAP=ON ^
-DBUILD_SHARED_LIBS=OFF ^
-DCMAKE_BUILD_TYPE=Debug ^
Expand Down
6 changes: 3 additions & 3 deletions cpack/innosetup/ecal_setup.iss.in
Original file line number Diff line number Diff line change
Expand Up @@ -75,8 +75,8 @@ Source: "{#ComponentStagingDir}\runtime\*"; DestDir: "{app}"; Fla
Source: "{#ComponentStagingDir}\Unspecified\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs; Components: runtime
Source: "{#ComponentStagingDir}\libraries\bin\*"; DestDir: "{app}\bin\"; Flags: ignoreversion recursesubdirs; Components: runtime

Source: "{#ComponentStagingDir}\_configuration\cfg\ecal.ini"; DestDir: "{commonappdata}\eCAL\"; Tasks: not replaceconf; Flags: ignoreversion confirmoverwrite; Components: runtime
Source: "{#ComponentStagingDir}\_configuration\cfg\ecal.ini"; DestDir: "{commonappdata}\eCAL\"; Tasks: replaceconf; Flags: ignoreversion; Components: runtime
Source: "{#ComponentStagingDir}\_configuration\cfg\ecal.yaml"; DestDir: "{commonappdata}\eCAL\"; Tasks: not replaceconf; Flags: ignoreversion confirmoverwrite; Components: runtime
Source: "{#ComponentStagingDir}\_configuration\cfg\ecal.yaml"; DestDir: "{commonappdata}\eCAL\"; Tasks: replaceconf; Flags: ignoreversion; Components: runtime
Source: "{#ComponentStagingDir}\_configuration\cfg\ecaltime.ini"; DestDir: "{commonappdata}\eCAL\"; Flags: ignoreversion; Components: runtime

; applications
Expand Down Expand Up @@ -132,7 +132,7 @@ Name: "{group}\eCAL Monitor"; Filename: "{app}\bin\ecal_
Name: "{group}\eCAL Recorder"; Filename: "{app}\bin\ecal_rec_gui.exe"; Components: applications
Name: "{group}\eCAL Player"; Filename: "{app}\bin\ecal_play_gui.exe"; Components: applications
Name: "{group}\eCAL Sys"; Filename: "{app}\bin\ecal_sys_gui.exe"; Components: applications
Name: "{group}\Configuration\Edit ecal.ini"; Filename: "{commonappdata}\eCAL\ecal.ini"; Components: runtime
Name: "{group}\Configuration\Edit ecal.yaml"; Filename: "{commonappdata}\eCAL\ecal.yaml"; Components: runtime

Name: "{group}\{cm:UninstallProgram,{#AppName}}"; Filename: "{uninstallexe}"
Name: "{commondesktop}\eCAL Launcher"; Filename: "{app}\bin\ecal_launcher.exe"; Tasks: desktopicon; Components: applications
Expand Down
18 changes: 9 additions & 9 deletions doc/rst/advanced/ecal_in_docker.rst
Original file line number Diff line number Diff line change
Expand Up @@ -193,10 +193,10 @@ Seamless IPC-Communication across host borders

.. important::
This will work with eCAL 5.12 and higher.
Older versions lack the ability to utilize the ``host_group_name`` in the :file:`ecal.ini` file, thus it won't work.
Older versions lack the ability to utilize the ``host_group_name`` in the :file:`ecal.yaml` file, thus it won't work.


In eCAL, you are able to set host belonging over network borders by utilizing the :file:`ecal.ini` configuration file with the same ``host_group_name`` - in the following steps, you will learn how to set this up.
In eCAL, you are able to set host belonging over network borders by utilizing the :file:`ecal.yaml` configuration file with the same ``host_group_name`` - in the following steps, you will learn how to set this up.

.. note::
If we don't set the same ``host_group_name`` on our Host and our Containers, an IPC-Communication across host borders is not available with different host names.
Expand All @@ -207,28 +207,28 @@ In eCAL, you are able to set host belonging over network borders by utilizing th
sudo docker network create --driver=bridge --subnet=10.0.10.0/24 my_network
#. Edit your :file:`ecal.ini` and run your Container within the newly created docker network
#. Edit your :file:`ecal.yaml` and run your Container within the newly created docker network

* You will use our previously discussed :ref:`ecal-runtime-image<ecal_in_docker>` for the next step.

* First, open :file:`/etc/ecal/ecal.ini` from your preferred editor.
* First, open :file:`/etc/ecal/ecal.yaml` from your preferred editor.

* Search for the line ``network_enabled`` and set it to ``true``.

* Search for the line ``host_group_name`` and write your preferred name.

* Save and close the :file:`ecal.ini` file.
* Save and close the :file:`ecal.yaml` file.

* Now your :file:`ecal.ini` file is prepared.
We want to use it not only for our Host-System but also for our Container, so we don't need to edit the :file:`ecal.ini` in our Container again.
* Now your :file:`ecal.yaml` file is prepared.
We want to use it not only for our Host-System but also for our Container, so we don't need to edit the :file:`ecal.yaml` in our Container again.
To achieve that, run following command to start your container:

.. code-block:: bash
sudo docker run --rm -it --ipc=host --pid=host --network=my_network --name=container1 -h=container1 --ip=10.0.10.10 -v /etc/ecal/ecal.ini:/etc/ecal/ecal.ini ecal-runtime
sudo docker run --rm -it --ipc=host --pid=host --network=my_network --name=container1 -h=container1 --ip=10.0.10.10 -v /etc/ecal/ecal.yaml:/etc/ecal/ecal.yaml ecal-runtime
- You should now be inside the root shell of your Container.
Check if your :file:`ecal.ini` file is correct.
Check if your :file:`ecal.yaml` file is correct.

- Now your Container is prepared and configured correctly, so we are ready to start an eCAL example.

Expand Down
6 changes: 3 additions & 3 deletions doc/rst/advanced/layers/shm.rst
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ Configuration
The SHM Layer is set to ``auto`` (= 2) by default.
This means, that it is used automatically for all messages that need to be transmitted inside a single host.

The system-configuration-parameters in the :file:`ecal.ini` are:
The system-configuration-parameters in the :file:`ecal.yaml` are:

.. code-block:: ini
Expand All @@ -76,7 +76,7 @@ If subscribers are too slow to process incoming messages then the overall softwa
There may still be cases where it could make sense to synchronize the transfer of the payload from a publisher to a subscriber by using an additional handshake event.
This event is signaled by a subscriber back to the sending publisher to confirm the complete payload transmission.

The handshake mechanism can be activated in the :file:`ecal.ini`:
The handshake mechanism can be activated in the :file:`ecal.yaml`:

.. code-block:: ini
Expand Down Expand Up @@ -147,7 +147,7 @@ You can activate the feature in the following ways.

- **Use multi-buffering as system-default**:

Edit your :file:`ecal.ini` and set a buffer count greater than 1:
Edit your :file:`ecal.yaml` and set a buffer count greater than 1:

.. code-block:: ini
Expand Down
2 changes: 1 addition & 1 deletion doc/rst/advanced/layers/shm_zerocopy.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ Enabling eCAL Zero Copy

- **Use zero-copy as system-default:**

Zero Copy can be enabled as system default from the :file:`ecal.ini` file like follows:
Zero Copy can be enabled as system default from the :file:`ecal.yaml` file like follows:

.. code-block:: ini
Expand Down
2 changes: 1 addition & 1 deletion doc/rst/advanced/layers/tcp.rst
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ You can activate TCP in the following ways:

#. **Use TCP as system default (only recommended for testing):**

Modify the :file:`ecal.ini` and change the following:
Modify the :file:`ecal.yaml` and change the following:

.. code-block:: ini
Expand Down
2 changes: 1 addition & 1 deletion doc/rst/advanced/message_drops.rst
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ Dropping on Transport Layer
- Having different link speeds in your network will almost always cause many drops for large messages, as you are e.g. sending with 10 Gbit to a 1Gbit port and so 90% of all packages are dropped.
This has to be viewed on a traffic-per-message-basis, not on a traffic-per-second basis. For instance, you may be sending only 1 message per second from a 10Gibt link. This message is maybe sent in 10ms, while the 1 Gbit link would need 100ms to receive all the data.
Consequently, the 1Gbit connection will inevitably start dropping fragments, even though the network is not even close to its capacity.
You can work around it by just connecting everything with the same link-speed, and by using the ``bandwidth_max_udp`` setting from the :ref:`ecal.ini <configuration_options>`
You can work around it by just connecting everything with the same link-speed, and by using the ``bandwidth_max_udp`` setting from the :ref:`ecal.yaml <configuration_options>`

- Larger eCAL Messages are more likely to be corrupt, as they consist of more fragments.

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ RUN apt-get install -y ecal
# You can omit this, if you don't want to build applications in the container.
RUN apt-get install -y cmake g++ libprotobuf-dev protobuf-compiler

# Set network_enabled = true in ecal.ini.
# Set network_enabled = true in ecal.yaml.
# You can omit this, if you only need local communication.
RUN awk -F"=" '/^network_enabled/{$2="= true"}1' /etc/ecal/ecal.ini > /etc/ecal/ecal.tmp && \
rm /etc/ecal/ecal.ini && \
mv /etc/ecal/ecal.tmp /etc/ecal/ecal.ini
RUN awk -F"=" '/^network_enabled/{$2="= true"}1' /etc/ecal/ecal.yaml > /etc/ecal/ecal.tmp && \
rm /etc/ecal/ecal.yaml && \
mv /etc/ecal/ecal.tmp /etc/ecal/ecal.yaml

# Print the eCAL config
RUN ecal_config
Loading

0 comments on commit 0d361d0

Please sign in to comment.