Skip to content

Removing Config Adapter - #455

Open
MaciejKaszynski wants to merge 16 commits into
eclipse-score:mainfrom
etas-contrib:new-config
Open

Removing Config Adapter#455
MaciejKaszynski wants to merge 16 commits into
eclipse-score:mainfrom
etas-contrib:new-config

Conversation

@MaciejKaszynski

@MaciejKaszynski MaciejKaszynski commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Fixes #420

Currently we have a lot of code to bridge the old config and new. This PR removes the bridge and changes. Process Group Manager, Graph and Alive Monitor to use the new config.

This also partially addresses some multi-og code from #413. However our IPC still has a field for the pg_name and there is still a bunch of references to it in comments and method names.

This also creates a temporary CreateDependencyGraph function that takes the config and creates a DependencyGraph from it. This is intentionally left as not polished and un covered with UTs as it shall be more or less removed in #463.

Another point to address is that the AliveMonitor copies its config as the shape of the config doesn't fit the current implementation. This will be addressed in #477.

@github-actions

github-actions Bot commented Aug 13, 2026

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.6.0) and connecting to it...
INFO: Invocation ID: 7fb2072a-30a1-4de3-bc91-c686983947c3
Computing main repo mapping: 
Computing main repo mapping: 
Loading: 
Loading: 0 packages loaded
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: 
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 (33 packages loaded, 10 targets configured)

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

Analyzing: target //:license-check (146 packages loaded, 2945 targets configured)

Analyzing: target //:license-check (160 packages loaded, 5907 targets configured)

Analyzing: target //:license-check (167 packages loaded, 9402 targets configured)

Analyzing: target //:license-check (172 packages loaded, 9451 targets configured)

Analyzing: target //:license-check (172 packages loaded, 9451 targets configured)

Analyzing: target //:license-check (174 packages loaded, 9575 targets configured)

INFO: Analyzed target //:license-check (177 packages loaded, 11589 targets configured).
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.740s, Critical Path: 0.25s
INFO: 16 processes: 4 disk cache hit, 12 internal.
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>]

@MaciejKaszynski
MaciejKaszynski deployed to workflow-approval August 14, 2026 13:45 — with GitHub Actions Active
@MaciejKaszynski
MaciejKaszynski deployed to workflow-approval August 14, 2026 13:45 — with GitHub Actions Active
@github-actions

Copy link
Copy Markdown

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

@danth danth left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The graph creation function is a bit long, but since it will be improved anyway after #463, I don't think it is worth making any major changes in this pull request.

{
score::concurrency::InterruptibleFuture<void> retVal_{};

std::cout << "Setting state " << pg_name << pg_state << std::endl;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Use LM_LOG_DEBUG, or remove this.

ISupervisionEventPublisher& supervision_event_publisher,
osal::IProcess* process_interface,
std::shared_ptr<SafeProcessMapInserter> process_map,
std::unordered_map<std::size_t, GraphIndex>& run_target_map)

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

run_target_map is not documented


LM_LOG_DEBUG() << "Process group index" << index << "(with name" << pg_name << ") has" << num_processes
<< "processes";
DependencyGraph<Graph::Component> graph(components.size() + run_targets.size() + 1);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we add a comment explaining why the + 1 is necessary?

component_name_to_index[component_name] = index;

// all of this relies on graphindex having sequential indexes
// TODO use IdHash later...

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe add a link to #463 and explain that this method will be simplified after that change.

{
return static_cast<int32_t>(index);
auto it = component_name_to_index.find(dep_name);
LM_LOG_ERROR() << run_targets[i].name << "HAS DEP TO " << dep_name;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
LM_LOG_ERROR() << run_targets[i].name << "HAS DEP TO " << dep_name;
LM_LOG_DEBUG() << run_targets[i].name << "HAS DEP TO " << dep_name;

Comment on lines +27 to +28
#include <ios>
#include <iostream>

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Not needed.

// Wait for process group states to change while actively draining shutdown events.
if (!graph_)
{
return;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should we log a warning here?

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.

Think I will actually make all graph_ checks to asserts as this shall never happen. We could actually make this not a shared_ptr and then remove the checks at all, but I will make an issue for this to do in another PR

Comment on lines +492 to +497
LM_LOG_DEBUG() << "HERER++++++++";
// Now process the request
switch (scc->request().request_or_response_)
{
case ControlClientCode::kSetStateRequest:
LM_LOG_DEBUG() << "HERER++++++++";

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Remove print debugging.

Comment on lines +716 to +717
// TODO: Determine recovery state from configuration
recovery_state.pg_state_name_ = IdentifierHash("fallback"); // TODO: Get from configuration

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Does this need to be done?

SCORE_LANGUAGE_FUTURECPP_PRECONDITION_MESSAGE(
it != component_name_to_index.end(), "RunTarget dependency not found in component list");

graph.addDependency(num_of_components + i, it->second);

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think this would be clearer if we had something like

for (std::size_t run_target_i = 0; run_target_i < run_targets.size(); ++run_target_i) {
  std::size_t node_i = num_of_components + run_target_i;

@WilliamRoebuck WilliamRoebuck left a comment

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.

Looks good, I have mostly small comments, one or two suggestions for code changes

#include <sys/stat.h>
#include <cerrno>
#include <cstdint>
#include <iostream>

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.

Remove

EXPECT_THAT(target.recovery_action.run_target, Eq("SafeState"));
}

TEST_F(FlatbufferConfigLoaderTest, ConfiguredOffRunTargetIsLoadedVerbatim)

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.

Can we add or extend a test to check that an "Off" target is created if none exists?

Comment on lines +34 to +35
using namespace score::mw::lifecycle::internal;
namespace configuration = score::mw::lifecycle::internal::configuration;

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.

These are probably not needed anymore

class Graph final
{
public:
/// @brief All possible implementation of a Component.

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
/// @brief All possible implementation of a Component.
/// @brief All currently supported component implementations

Comment on lines +107 to +111
auto it = component_name_to_index.find(dep_name);
SCORE_LANGUAGE_FUTURECPP_PRECONDITION_MESSAGE(
it != component_name_to_index.end(), "Component dependency not found in component list");

SCORE_LANGUAGE_FUTURECPP_ASSERT_DBG_MESSAGE(states != nullptr, "Process group states not found for process group");
graph.addDependency(comp_dep_i, it->second);

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.

This addDependency section is repeated 3 times, can we add a helper function/lambda? Or even better maybe we can iterate through all the dependencies in one loop somehow?

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.

Maybe you can add everything to the graph and then iterate through graph items, accessing the config by index?

/// @details The implementation should be async signal safe.
OsalReturnType ProcessLauncher::setSchedulingAndSecurity(const OsalConfig& config)
OsalReturnType ProcessLauncher::setSchedulingAndSecurity(
const score::mw::lifecycle::internal::configuration::ComponentConfig& 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.

Can we pass just the deployment config here?

alive_monitor_thread_->stop();
configuration_.deinitialize();
process_groups_.clear();
// No deinitialize needed - Config destructor handles cleanup

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 don't think we need this comment

}
return result;
SCORE_LANGUAGE_FUTURECPP_ASSERT_MESSAGE(bool(graph_), "Graph not initialized");
// Convert string_view to IdentifierHash

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.

There's a constructor at IdentifierHash.cpp:66, doesn't it work?

Comment on lines +700 to +701
// TODO: Determine recovery state from configuration
recovery_state.pg_state_name_ = IdentifierHash("fallback"); // TODO: Get from configuration

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.

Double // TODO: 🙂

recovery_state.pg_state_name_ = IdentifierHash("fallback"); // TODO: Get from configuration

LM_LOG_WARN() << "Problem discovered in PG" << recovery_state.pg_name_ << "Activating Recovery state.";
LM_LOG_WARN() << "Problem discovered, activating recovery state: " << recovery_state.pg_state_name_;

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
LM_LOG_WARN() << "Problem discovered, activating recovery state: " << recovery_state.pg_state_name_;
LM_LOG_WARN() << "Problem discovered, activating recovery state:" << recovery_state.pg_state_name_;

Extra space

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

Labels

None yet

Projects

Status: Backlog

Development

Successfully merging this pull request may close these issues.

Remove Configuration Adapter

3 participants