Skip to content

Commit 757d17d

Browse files
NicolasFussbergerEmpting Eelco (ETAS-ECM/XPC-Fe2)eelcoemSimonKozikpaulquiring
authored
Launch Manager supports the new configuration format (#110)
* Basic python setup for mapping script * Add latest example configuration * Merging of default values * Basic smoketest for defaults preprocessing * Start to map PHM configuration * Separate unit and integration tests * Document mapping decisions and initial known limitations * Copy dict only internally when merging defaults * Initial mapping of hm configuration * Treat StateManager supervision same as other supervisions * Fix time unit and some flatbuffer schema violations * basic Integration test for health configuration * Better nameing of env vars in unit test * Configs for health integration test * Start work * Almost done * Add validation and update sample configs * Add health test for empty config * Update Readme file with validation info * Continue config mapping script * Cleanup * Fix error in mapping script * Minor fixes * Cleanup * Prevent cyclic dependencies * First changes * Cleanup * Undo some changes * Undo some changes * Bazel command for lifecylce config gen * Undo more changes, fix out of range * Config generation working without pip dependency * More cleanup * Export jsonschema python dependency * Fix python formatting * Adapt expected output to file renaming * Make shortName required * Update Readme file with bazel interface * Move script to tests folder * Initial version of the new API * Remove flatbuffer script * Address reviewer comments * Adapt ControlClient implementation to new API * Update health config integration test * Fix merge error in MODULE.bazel * Adapt examples to use the bazel config generation * Start demo via bazel target * Merge different pip environments * Add some custom validation rules * Migrate smoketest to new configuration * More integration tests * Revert debugging changes * Fix example scenario configuration * Correct smoketest configuration * Revert more debugging changes * Fix crash * Remove temporary schema file * Update readme file * Clarify that certain attributes will be ignored * Use lowercase name for watchdog * Run config tests via bazel * Define central lifecycle bazel rules * Add progress message to bazel function * Make pip environment a proper dependency This environment is used in the public bazel function for config generation * Improve error message * Remove obsolete config scripts * Fix formatting * Fix copyright headers * Tidy MODULE.bazel file * Improve schema validation error message * Fix formatting * Use defined default values in configuration mapping * Simplify bazel example runner --------- Co-authored-by: Empting Eelco (ETAS-ECM/XPC-Fe2) <Eelco.Empting2@etas.com> Co-authored-by: Eelco Empting <158553993+eelcoem@users.noreply.github.com> Co-authored-by: SimonKozik <244535158+SimonKozik@users.noreply.github.com> Co-authored-by: Paul Quiring <paul.quiring@etas.com>
1 parent 1bd00fa commit 757d17d

76 files changed

Lines changed: 4887 additions & 1309 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

MODULE.bazel

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -124,13 +124,14 @@ python.toolchain(
124124
python_version = PYTHON_VERSION,
125125
)
126126

127-
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip", dev_dependency = True)
127+
# Python pip dependencies
128+
pip = use_extension("@rules_python//python/extensions:pip.bzl", "pip")
128129
pip.parse(
129-
hub_name = "pip_score_venv_test",
130+
hub_name = "score_lifecycle_pip",
130131
python_version = PYTHON_VERSION,
131-
requirements_lock = "//tests/integration:requirements.lock",
132+
requirements_lock = "//:requirements_lock.txt",
132133
)
133-
use_repo(pip, "pip_score_venv_test")
134+
use_repo(pip, "score_lifecycle_pip")
134135

135136
bazel_dep(name = "score_baselibs_rust", version = "0.1.0")
136137
bazel_dep(name = "score_baselibs", version = "0.2.4")
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,10 @@
1010
#
1111
# SPDX-License-Identifier: Apache-2.0
1212
# *******************************************************************************
13-
def get_process_index_range(process_count: int, process_group_index: int):
14-
# Every ProcessGroup gets the same number of processes
15-
# The Process Index is a globally unique increasing number
16-
return range(
17-
process_group_index * process_count,
18-
(process_group_index * process_count) + process_count,
19-
)
13+
14+
"""Unified entrypoint for lifecycle Bazel macros & rules."""
15+
16+
# --- Launch Manager Configuration ---
17+
load("//scripts/config_mapping:config.bzl", _launch_manager_config = "launch_manager_config")
18+
19+
launch_manager_config = _launch_manager_config

examples/BUILD

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
load("//:defs.bzl", "launch_manager_config")
14+
15+
launch_manager_config(
16+
name = "example_config",
17+
config = "//examples/config:lifecycle_demo_config",
18+
)
19+
20+
filegroup(
21+
name = "example_apps",
22+
srcs = [
23+
"//examples:example_config",
24+
"//examples/control_application:control_daemon",
25+
"//examples/control_application:lmcontrol",
26+
"//examples/cpp_lifecycle_app",
27+
"//examples/cpp_supervised_app",
28+
"//examples/rust_supervised_app",
29+
],
30+
)
31+
32+
filegroup(
33+
name = "lm_binaries",
34+
srcs = [
35+
"//src/control_client_lib",
36+
"//src/launch_manager_daemon:launch_manager",
37+
"//src/launch_manager_daemon/lifecycle_client_lib:lifecycle_client",
38+
"//src/launch_manager_daemon/process_state_client_lib:process_state_client",
39+
],
40+
)
41+
42+
sh_binary(
43+
name = "run_examples",
44+
srcs = ["run.sh"],
45+
data = [
46+
":example_apps",
47+
":lm_binaries",
48+
],
49+
)

examples/README.md

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,23 +2,20 @@
22

33
## Building & Running the demo setup
44

5-
1. Build launch_manager and health_monitor, in the parent folder, first.
6-
2. Then start run.sh script in this folder: `cd demo && ./run.sh`
5+
Execute `bazel run //examples:run_examples --config=<...>`. This will build all dependences and run the run.sh script
76

87
The run.sh script will:
98

10-
- Copy the required binaries to a temporary directory demo/tmp
11-
- Compile the json configuration to flatbuffer using flatc
129
- Build a docker image for execution with the required artifacts inside
1310
- Start the docker container that runs launch_manager
1411

1512
## Interacting with the Demo
1613

17-
### Changing ProcessGroup States
14+
### Changing RunTargets
1815

19-
There is a CLI application that allows to request transition to a certain ProcessGroup State.
16+
There is a CLI application that allows to request transition to a certain RunTarget.
2017

21-
Example: `lmcontrol ProcessGroup1/Startup`
18+
Example: `lmcontrol Startup`
2219

2320
### Triggering Supervision Failure
2421

@@ -31,4 +28,4 @@ Example: `fail <PID>`
3128
There is an interactive mode that walks you through two demo scenarios.
3229
This mode requires the run.sh script to be executed **in an active tmux** session.
3330

34-
`cd demo && ./run.sh tmux`
31+
`bazel run //examples:run_examples --config=<...> -- tmux`

examples/config/BUILD

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
# *******************************************************************************
2+
# Copyright (c) 2026 Contributors to the Eclipse Foundation
3+
#
4+
# See the NOTICE file(s) distributed with this work for additional
5+
# information regarding copyright ownership.
6+
#
7+
# This program and the accompanying materials are made available under the
8+
# terms of the Apache License Version 2.0 which is available at
9+
# https://www.apache.org/licenses/LICENSE-2.0
10+
#
11+
# SPDX-License-Identifier: Apache-2.0
12+
# *******************************************************************************
13+
exports_files(
14+
["lifecycle_demo.json"],
15+
visibility = ["//examples:__subpackages__"],
16+
)
17+
18+
filegroup(
19+
name = "lifecycle_demo_config",
20+
srcs = ["lifecycle_demo.json"],
21+
visibility = ["//examples:__subpackages__"],
22+
)

0 commit comments

Comments
 (0)