Skip to content

Feature/load new lifecycle config#208

Draft
NicolasFussberger wants to merge 10 commits into
eclipse-score:mainfrom
etas-contrib:feature/load-new-lifecycle-config
Draft

Feature/load new lifecycle config#208
NicolasFussberger wants to merge 10 commits into
eclipse-score:mainfrom
etas-contrib:feature/load-new-lifecycle-config

Conversation

@NicolasFussberger
Copy link
Copy Markdown
Contributor

@NicolasFussberger NicolasFussberger commented May 19, 2026

  • Introduces an interface in src/launch_manager_daemon/config for loading a launch manager configuration file
  • Introduce an implementation of this interface using flatbuffer
  • Introduce unit tests for the new code

Note: The code is not actually in use yet. The python script which does the translation from the user-facing json configuration to the flatbuffer json format is not part of the PR and will be added in a follow up PR.
Furthermore, the launch manager code needs to be adapted to use the new structure.

Background:

  • In the last months we had defined a new user-facing configuration format (see src/launch_manager_daemon/config/config_schema/launch_manager.schema.json).
  • However, this new format is currently still mapped to the old configuration files (to processes / process groups). So the code is not actually reading the new configuration file

Relates To: #209

@github-actions
Copy link
Copy Markdown

License Check Results

🚀 The license check job ran with the Bazel command:

bazel run --lockfile_mode=error //:license-check

Status: ⚠️ Needs Review

Click to expand output
[License Check Output]
Extracting Bazel installation...
Starting local Bazel server (8.4.2) and connecting to it...
INFO: Invocation ID: c7bf8963-f47b-478e-9fd6-66b1dd2d3e94
Computing main repo mapping: 
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
Loading: 0 packages loaded
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Loading: 0 packages loaded
    currently loading: 
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)
Analyzing: target //:license-check (1 packages loaded, 0 targets configured)

Analyzing: target //:license-check (38 packages loaded, 10 targets configured)

Analyzing: target //:license-check (86 packages loaded, 10 targets configured)

Analyzing: target //:license-check (138 packages loaded, 2720 targets configured)

Analyzing: target //:license-check (150 packages loaded, 5404 targets configured)

Analyzing: target //:license-check (155 packages loaded, 5453 targets configured)

Analyzing: target //:license-check (158 packages loaded, 8002 targets configured)

Analyzing: target //:license-check (162 packages loaded, 10142 targets configured)

INFO: Analyzed target //:license-check (163 packages loaded, 10268 targets configured).
[7 / 15] checking cached actions
[12 / 16] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes; 0s disk-cache, processwrapper-sandbox ... (2 actions running)
[14 / 16] JavaToolchainCompileBootClasspath external/rules_java+/toolchains/platformclasspath.jar; 0s disk-cache, processwrapper-sandbox
INFO: Found 1 target...
Target //:license.check.license_check up-to-date:
  bazel-bin/license.check.license_check
  bazel-bin/license.check.license_check.jar
INFO: Elapsed time: 23.467s, Critical Path: 2.79s
INFO: 16 processes: 12 internal, 3 processwrapper-sandbox, 1 worker.
INFO: Build completed successfully, 16 total actions
INFO: Running command line: bazel-bin/license.check.license_check ./formatted.txt <args omitted>
usage: org.eclipse.dash.licenses.cli.Main [-batch <int>] [-cd <url>]
       [-confidence <int>] [-ef <url>] [-excludeSources <sources>] [-help] [-lic
       <url>] [-project <shortname>] [-repo <url>] [-review] [-summary <file>]
       [-timeout <seconds>] [-token <token>]

@github-actions
Copy link
Copy Markdown

The created documentation from the pull request is available at: docu-html

Comment thread MODULE.bazel
module_name = "score_baselibs",
commit = "498a4b256c9073602140243d30c33b106e279f75",
remote = "https://github.com/eclipse-score/baselibs.git",
)
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@paulquiring Any idea when a new baselibs release will be available containing the new flatbuffer functionality?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

{
Native = 0,
Reporting = 1,
ReportingAndSupervised = 2,
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would just Supervised be sufficient? I guess Supervised applications have to be reporting or else they cannot be supervised?

Terminated = 1
};

struct ComponentAliveSupervision
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All struct members are default initialized to 0. I think to have some default values here which make sense could be helpful.

This applies also to all other configuration structs.


} // namespace score::launch_manager::config

#endif
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
#endif
#endif // CONFIG_HPP

///
/// @note As of now, everything is expected in a single config file.
/// Even though some fields appear as optional in the json schema, they are only optional if the configuration would be
/// split across multiple files. As only a single file is supported, the single config will contain all fields.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

"Even though some fields appear as optional in the json schema, they are only optional if the configuration would be split across multiple files"

That is strange, why splitting configuration into more then one file influencing what optional means?

I would expect that everything which is std::optional in config.hpp simply does not need to configured.

{
return fallback_run_target_;
}
const AliveSupervisionConfig& alive_supervision() const
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it's quite a mix of styles.
setRunTargets and fallback_run_target, just one will do the job.

}

private:
friend class Builder;
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A comment would have been helpful to mention that this saves the need to write getters in the builder class.

/// @note As of now, everything is expected in a single config file.
/// Even though some fields appear as optional in the json schema, they are only optional if the configuration would be
/// split across multiple files. As only a single file is supported, the single config will contain all fields.
class Config
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It should be also possible to implement the Config member functions in the config.cpp file.

std::vector<std::string> result;
if (vec != nullptr)
{
result.reserve(vec->size());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm happy to see this line.

{
if (ev != nullptr && ev->key() != nullptr)
{
result.emplace(ev->key()->str(), safeString(ev->value()));
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I guess the key cannot be nullptr?


SwitchRunTargetAction convertRequiredSwitchRunTargetAction(const fb::SwitchRunTargetAction* sa)
{
return convertSwitchRunTargetAction(sa).value();
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

value can throw.
Image

.value_or(std::string{}) as alternative?

Comment thread MODULE.bazel
module_name = "score_baselibs",
commit = "498a4b256c9073602140243d30c33b106e279f75",
remote = "https://github.com/eclipse-score/baselibs.git",
)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

constexpr int32_t kExpectedSchemaVersion = 1;
constexpr double kSecondsToMilliseconds = 1000.0;

uint32_t secondsToMs(double seconds)
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

#include <iostream>
#include <cstdint>
#include <string_view>
#include <cassert>

constexpr double kSecondsToMilliseconds = 1000.0;

uint32_t secondsToMs(double seconds)
{
    return static_cast<uint32_t>(seconds * kSecondsToMilliseconds);
}

int main () {
    assert(secondsToMs(0.000500) == 0);// holds is this a problem ?
    assert(secondsToMs(0.001000) == 1);
}

if this is a problem we might need to change the fbs

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants