Skip to content

Removing Config Adapter - #455

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

Removing Config Adapter#455
MaciejKaszynski wants to merge 17 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: c3d14e12-24e4-4d79-8c4a-68f2a2ba82cf
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: 
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 (34 packages loaded, 10 targets configured)

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

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

Analyzing: target //:license-check (152 packages loaded, 3161 targets configured)

Analyzing: target //:license-check (161 packages loaded, 5053 targets configured)

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

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

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

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

INFO: Analyzed target //:license-check (177 packages loaded, 11589 targets configured).
[9 / 15] [Prepa] JavaToolchainCompileClasses external/rules_java+/toolchains/platformclasspath_classes ... (2 actions, 0 running)
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: 26.259s, Critical Path: 0.28s
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>]

@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.

Comment thread score/launch_manager/src/control_client/src/details/control_client_impl.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/process_group_manager/details/graph.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/process_group_manager/details/graph.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/process_group_manager/details/graph.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/process_group_manager/details/transition.hpp Outdated
Comment thread score/launch_manager/src/daemon/src/process_group_manager/details/graph.cpp Outdated

@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

Comment thread score/launch_manager/src/control_client/src/details/control_client_impl.cpp Outdated
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 thread score/launch_manager/src/daemon/src/process_group_manager/details/graph.cpp Outdated
Comment thread score/launch_manager/src/daemon/src/process_group_manager/details/graph.hpp Outdated
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?

return static_cast<int32_t>(index);
}
auto off_index = graph.emplace(std::in_place_type<RunTarget>, graph.size());
run_target_map.insert({IdentifierHash{"Off"}.data(), off_index});

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.

The "Off" name exists in many locations as hardcoded string. Maybe we can move this to a single constant

// on https://github.com/eclipse-score/lifecycle/issues/463
// making the dep_graph a hash map would make this much cleaner as we
// wouldn't have to keep track of stuff...
const std::vector<configuration::RunTargetConfig> run_targets = config.takeRunTargets();

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.

process group manager still uses configuration_.runTargets() even though its been moved out here

// Off can be configred by the user and would mean we need +1 but
// over-reserving is ok.
// fallback is always created.
const std::size_t graph_size = components.size() + run_targets.size() + 2U;

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 calculation exists in a duplicate way also here in process_group_manager.cpp:207

off_rt_defined |= bool(run_target.name == "Off");
component_name_to_index[run_target.name] = index;
run_target_map.insert({IdentifierHash{run_target.name}.data(), index});
};

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
};
}


for (const auto process_index : state.process_indexes_)
off_rt_defined |= bool(run_target.name == "Off");
component_name_to_index[run_target.name] = index;

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.

is it ensured that component and run target names are unique, otherwise this may silently overwrite a preexisting name

/// @param process_map Map for tracking process PIDs.
/// @param run_target_map Map to keep the translation between IDHash to Index
/// @return A populated dependency graph with all components and run targets.
DependencyGraph<Graph::Component> CreateDependencyGraph(

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.

Its a rather long private method with many parameters. I wonder if this can be refactored to make it simpler and more easily testable by having e.g. a separate GraphBuilder class or something like that

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.

This method will already need to be rewritten as part of #463, so I think it could be left for a separate PR?

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.

Will this ticket really dramatically change the scope of this method?

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 suppose not from an external perspective, but I think the implementation inside will change a lot.

return success;
graph_ = std::make_shared<Graph>(
// size is +2 for fallback + off
configuration_.components().size() + configuration_.runTargets().size() + 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.

I wonder if this size can be inferred from the configuration inside the Graph, so that this calculation does not need to exist multiple times

// Single-graph assumption: PGM creates one ProcessMonitor bound to the first (only) graph, so
// every event always applies to it. Multi-graph routing is deferred to a future revision.
Graph& graph = *process_groups_.front();
SCORE_LANGUAGE_FUTURECPP_ASSERT_MESSAGE(bool(graph_), "Graph not initialized");

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 suppose we should probably use static_cast over c-style casts

const IdentifierHash old_state = graph_->getProcessGroupState();
// the fallback state doesn't have a name in the config, so we use
// "fallback", it doesn't actually matter...
const IdentifierHash recovery_state("fallback");

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 name exists in multiple places as hardcoded string and they need to be identical for things to work, so I would recommend to move this to a single constant.

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

4 participants