From ec32ad0485e4fdb3a12a1275bf20a025321569a7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Thu, 12 Feb 2026 08:21:29 +0100 Subject: [PATCH 1/4] Move test execution to shell script We require a custom script as we need different commands when running on QNX vs. Linux which is not possible with the json-based showcase execution --- integration/showcases/simple_lifecycle/BUILD | 11 ++++--- .../simple_lifecycle/configs/lm_demo.json | 9 ++---- ...demo.json => supervised_cpp_app_demo.json} | 0 .../simple_lifecycle/lifecycle_demo.sh | 31 +++++++++++++++++++ .../simple_lifecycle.score.json | 16 ++-------- 5 files changed, 41 insertions(+), 26 deletions(-) rename integration/showcases/simple_lifecycle/configs/{supervised_app_demo.json => supervised_cpp_app_demo.json} (100%) create mode 100755 integration/showcases/simple_lifecycle/lifecycle_demo.sh diff --git a/integration/showcases/simple_lifecycle/BUILD b/integration/showcases/simple_lifecycle/BUILD index fd17ee51a0..f448e55a29 100644 --- a/integration/showcases/simple_lifecycle/BUILD +++ b/integration/showcases/simple_lifecycle/BUILD @@ -7,6 +7,7 @@ score_pkg_bundle( "@score_lifecycle_health//src/launch_manager_daemon:launch_manager", "@score_lifecycle_health//examples/cpp_supervised_app", "@score_lifecycle_health//examples/control_application:control_daemon", + ":lifecycle_demo.sh" ], config_data = [ "//showcases/simple_lifecycle:simple_lifecycle.score.json", @@ -15,7 +16,7 @@ score_pkg_bundle( custom_layout = { ":lm_demo.bin": "etc/lm_demo.bin", ":hm_demo.bin": "etc/hm_demo.bin", - ":supervised_app_demo.bin": "etc/supervised_app_demo.bin", + ":supervised_cpp_app_demo.bin": "etc/supervised_cpp_app_demo.bin", }, ) @@ -38,11 +39,11 @@ genrule( ) genrule( - name = "supervised_app_demo.bin", - srcs = ["@score_lifecycle_health//src/launch_manager_daemon/health_monitor_lib:hm_flatcfg_fbs", "//showcases/simple_lifecycle/configs:supervised_app_demo.json"], - outs = ["supervised_app_demo.bin"], + name = "supervised_cpp_app_demo.bin", + srcs = ["@score_lifecycle_health//src/launch_manager_daemon/health_monitor_lib:hm_flatcfg_fbs", "//showcases/simple_lifecycle/configs:supervised_cpp_app_demo.json"], + outs = ["supervised_cpp_app_demo.bin"], tools = ["@flatbuffers//:flatc"], - cmd = "$(location @flatbuffers//:flatc) --binary $(SRCS) && mv supervised_app_demo.bin $(location supervised_app_demo.bin)", + cmd = "$(location @flatbuffers//:flatc) --binary $(SRCS) && mv supervised_cpp_app_demo.bin $(location supervised_cpp_app_demo.bin)", visibility = ["//visibility:public"], ) diff --git a/integration/showcases/simple_lifecycle/configs/lm_demo.json b/integration/showcases/simple_lifecycle/configs/lm_demo.json index cb7ef56a8a..8477b8a0ca 100644 --- a/integration/showcases/simple_lifecycle/configs/lm_demo.json +++ b/integration/showcases/simple_lifecycle/configs/lm_demo.json @@ -62,12 +62,7 @@ "enterTimeoutValue": 2000, "exitTimeoutValue": 2000, "terminationBehavior": "ProcessIsNotSelfTerminating", - "executionDependency": [ - { - "stateName": "Running", - "targetProcess_identifier": "/healthmonitorApp/healthmonitor" - } - ], + "executionDependency": [], "processGroupStateDependency": [ { "stateMachine_name": "MainPG", @@ -85,7 +80,7 @@ }, { "key": "CONFIG_PATH", - "value": "/showcases/data/simple_lifecycle/etc/supervised_app_demo.bin" + "value": "/showcases/data/simple_lifecycle/etc/supervised_cpp_app_demo.bin" }, { "key": "IDENTIFIER", diff --git a/integration/showcases/simple_lifecycle/configs/supervised_app_demo.json b/integration/showcases/simple_lifecycle/configs/supervised_cpp_app_demo.json similarity index 100% rename from integration/showcases/simple_lifecycle/configs/supervised_app_demo.json rename to integration/showcases/simple_lifecycle/configs/supervised_cpp_app_demo.json diff --git a/integration/showcases/simple_lifecycle/lifecycle_demo.sh b/integration/showcases/simple_lifecycle/lifecycle_demo.sh new file mode 100755 index 0000000000..4a97bf2fab --- /dev/null +++ b/integration/showcases/simple_lifecycle/lifecycle_demo.sh @@ -0,0 +1,31 @@ +#! /bin/sh + +running_on_qnx() { + [ -x "$(command -v slay)" ] +} + +echo "\nStep 1: Starting Launch Manager\n" +cd /showcases/data/simple_lifecycle +/showcases/bin/launch_manager& + +sleep 2 + +echo "\nStep 2: Make application stop reporting alive notifications\n" + +if running_on_qnx +then + slay -s SIGUSR1 -f cpp_supervised_app +else + pkill -SIGUSR1 -f cpp_supervised_app +fi + +sleep 5 + +echo "\nStep 3: Shutdown Launch Manager\n" + +if running_on_qnx +then + slay -f launch_manager +else + pkill -f launch_manager +fi diff --git a/integration/showcases/simple_lifecycle/simple_lifecycle.score.json b/integration/showcases/simple_lifecycle/simple_lifecycle.score.json index 4adfd429bd..ab3951b51d 100644 --- a/integration/showcases/simple_lifecycle/simple_lifecycle.score.json +++ b/integration/showcases/simple_lifecycle/simple_lifecycle.score.json @@ -3,22 +3,10 @@ "description": "Example runs two applications and monitors if they are healthy. When some application is malfunctioning, this will be recorded. Examples takes ~15s", "apps": [ { - "path": "/showcases/bin/launch_manager", - "dir": "/showcases/data/simple_lifecycle", + "path": "/showcases/bin/lifecycle_demo.sh", + "dir": "/", "args": [], "env": {} - }, - { - "path": "pkill", - "args": ["-f", "cpp_supervised_app", "-SIGUSR1"], - "env": {}, - "delay": 5 - }, - { - "path": "pkill", - "args": ["-f", "launch_manager"], - "env": {}, - "delay": 2 } ] } From ed9d068a0c6085e3e9712432a846635d37b79b16 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Thu, 12 Feb 2026 09:07:07 +0100 Subject: [PATCH 2/4] Add rust example app and cleanup configs --- integration/showcases/simple_lifecycle/BUILD | 21 +++-- .../showcases/simple_lifecycle/configs/BUILD | 3 +- .../configs/cpp_supervised_app_demo.json | 14 ++++ .../simple_lifecycle/configs/hm_demo.json | 84 ++++++++++++++++--- .../simple_lifecycle/configs/lm_demo.json | 60 +++++++++++-- .../configs/rust_supervised_app_demo.json | 15 ++++ .../configs/supervised_cpp_app_demo.json | 14 ---- .../simple_lifecycle/lifecycle_demo.sh | 2 +- .../simple_lifecycle.score.json | 2 +- 9 files changed, 177 insertions(+), 38 deletions(-) create mode 100644 integration/showcases/simple_lifecycle/configs/cpp_supervised_app_demo.json create mode 100644 integration/showcases/simple_lifecycle/configs/rust_supervised_app_demo.json delete mode 100644 integration/showcases/simple_lifecycle/configs/supervised_cpp_app_demo.json diff --git a/integration/showcases/simple_lifecycle/BUILD b/integration/showcases/simple_lifecycle/BUILD index f448e55a29..1b4b7d773b 100644 --- a/integration/showcases/simple_lifecycle/BUILD +++ b/integration/showcases/simple_lifecycle/BUILD @@ -6,6 +6,7 @@ score_pkg_bundle( bins = [ "@score_lifecycle_health//src/launch_manager_daemon:launch_manager", "@score_lifecycle_health//examples/cpp_supervised_app", + "@score_lifecycle_health//examples/rust_supervised_app", "@score_lifecycle_health//examples/control_application:control_daemon", ":lifecycle_demo.sh" ], @@ -16,7 +17,8 @@ score_pkg_bundle( custom_layout = { ":lm_demo.bin": "etc/lm_demo.bin", ":hm_demo.bin": "etc/hm_demo.bin", - ":supervised_cpp_app_demo.bin": "etc/supervised_cpp_app_demo.bin", + ":cpp_supervised_app_demo.bin": "etc/cpp_supervised_app_demo.bin", + ":rust_supervised_app_demo.bin": "etc/rust_supervised_app_demo.bin", }, ) @@ -39,11 +41,20 @@ genrule( ) genrule( - name = "supervised_cpp_app_demo.bin", - srcs = ["@score_lifecycle_health//src/launch_manager_daemon/health_monitor_lib:hm_flatcfg_fbs", "//showcases/simple_lifecycle/configs:supervised_cpp_app_demo.json"], - outs = ["supervised_cpp_app_demo.bin"], + name = "cpp_supervised_app_demo.bin", + srcs = ["@score_lifecycle_health//src/launch_manager_daemon/health_monitor_lib:hm_flatcfg_fbs", "//showcases/simple_lifecycle/configs:cpp_supervised_app_demo.json"], + outs = ["cpp_supervised_app_demo.bin"], tools = ["@flatbuffers//:flatc"], - cmd = "$(location @flatbuffers//:flatc) --binary $(SRCS) && mv supervised_cpp_app_demo.bin $(location supervised_cpp_app_demo.bin)", + cmd = "$(location @flatbuffers//:flatc) --binary $(SRCS) && mv cpp_supervised_app_demo.bin $(location cpp_supervised_app_demo.bin)", + visibility = ["//visibility:public"], +) + +genrule( + name = "rust_supervised_app_demo.bin", + srcs = ["@score_lifecycle_health//src/launch_manager_daemon/health_monitor_lib:hm_flatcfg_fbs", "//showcases/simple_lifecycle/configs:rust_supervised_app_demo.json"], + outs = ["rust_supervised_app_demo.bin"], + tools = ["@flatbuffers//:flatc"], + cmd = "$(location @flatbuffers//:flatc) --binary $(SRCS) && mv rust_supervised_app_demo.bin $(location rust_supervised_app_demo.bin)", visibility = ["//visibility:public"], ) diff --git a/integration/showcases/simple_lifecycle/configs/BUILD b/integration/showcases/simple_lifecycle/configs/BUILD index 397d72d65a..d1cba824a5 100644 --- a/integration/showcases/simple_lifecycle/configs/BUILD +++ b/integration/showcases/simple_lifecycle/configs/BUILD @@ -1,5 +1,6 @@ exports_files([ "hm_demo.json", "lm_demo.json", - "supervised_app_demo.json" + "cpp_supervised_app_demo.json", + "rust_supervised_app_demo.json" ]) \ No newline at end of file diff --git a/integration/showcases/simple_lifecycle/configs/cpp_supervised_app_demo.json b/integration/showcases/simple_lifecycle/configs/cpp_supervised_app_demo.json new file mode 100644 index 0000000000..ba154982b5 --- /dev/null +++ b/integration/showcases/simple_lifecycle/configs/cpp_supervised_app_demo.json @@ -0,0 +1,14 @@ +{ + "versionMajor": 8, + "versionMinor": 0, + "process": [], + "hmMonitorInterface": [ + { + "instanceSpecifier": "cpp_supervised_app", + "processShortName": "cpp_supervised_app", + "portPrototype": "Port", + "interfacePath": "lifecycle_cpp_supervised_app", + "refProcessIndex":0 + } + ] +} diff --git a/integration/showcases/simple_lifecycle/configs/hm_demo.json b/integration/showcases/simple_lifecycle/configs/hm_demo.json index 7828a44457..f1dfa0121f 100644 --- a/integration/showcases/simple_lifecycle/configs/hm_demo.json +++ b/integration/showcases/simple_lifecycle/configs/hm_demo.json @@ -4,8 +4,24 @@ "process": [ { "index": 0, - "shortName": "demo_application0", - "identifier": "demo_app0_MainPG", + "shortName": "cpp_supervised_app", + "identifier": "cpp_supervised_app", + "processType": "REGULAR_PROCESS", + "refProcessGroupStates": [ + { + "identifier": "MainPG/Startup" + } + ], + "processExecutionErrors": [ + { + "processExecutionError": 1 + } + ] + }, + { + "index": 1, + "shortName": "rust_supervised_app", + "identifier": "rust_supervised_app", "processType": "REGULAR_PROCESS", "refProcessGroupStates": [ { @@ -21,24 +37,37 @@ ], "hmMonitorInterface": [ { - "instanceSpecifier": "demo/demo_application0/Port1", - "processShortName": "demo_application0", - "portPrototype": "Port1", - "interfacePath": "demo_application_0_MainPG", + "instanceSpecifier": "cpp_supervised_app", + "processShortName": "cpp_supervised_app", + "portPrototype": "Port", + "interfacePath": "lifecycle_cpp_supervised_app", "refProcessIndex": 0, "permittedUid": 0 + }, + { + "instanceSpecifier": "rust_supervised_app", + "processShortName": "rust_supervised_app", + "portPrototype": "Port", + "interfacePath": "lifecycle_rust_supervised_app", + "refProcessIndex": 1, + "permittedUid": 0 } ], "hmSupervisionCheckpoint": [ { - "shortName": "Checkpoint0_1", + "shortName": "checkpoint_cpp_supervised_app", "checkpointId": 1, "refInterfaceIndex": 0 + }, + { + "shortName": "checkpoint_rust_supervised_app", + "checkpointId": 1, + "refInterfaceIndex": 1 } ], "hmAliveSupervision": [ { - "ruleContextKey": "AliveSupervision0", + "ruleContextKey": "AliveSupervision_cpp_supervised_app", "refCheckPointIndex": 0, "aliveReferenceCycle": 200.0, "minAliveIndications": 1, @@ -52,14 +81,30 @@ "identifier": "MainPG/Startup" } ] - } + }, + { + "ruleContextKey": "AliveSupervision_rust_supervised_app", + "refCheckPointIndex": 1, + "aliveReferenceCycle": 100.0, + "minAliveIndications": 1, + "maxAliveIndications": 3, + "isMinCheckDisabled": false, + "isMaxCheckDisabled": false, + "failedSupervisionCyclesTolerance": 1, + "refProcessIndex": 1, + "refProcessGroupStates": [ + { + "identifier": "MainPG/Startup" + } + ] + }, ], "hmDeadlineSupervision": [], "hmLogicalSupervision": [], "hmLocalSupervision": [ { - "ruleContextKey": "LocalSupervision0", - "infoRefInterfacePath": "demo_application_0", + "ruleContextKey": "LocalSupervision_cpp_supervised_app", + "infoRefInterfacePath": "cpp_supervised_app", "hmRefAliveSupervision": [ { "refAliveSupervisionIdx": 0 @@ -67,6 +112,17 @@ ], "hmRefDeadlineSupervision": [], "hmRefLogicalSupervision": [] + }, + { + "ruleContextKey": "LocalSupervision_rust_supervised_app", + "infoRefInterfacePath": "rust_supervised_app", + "hmRefAliveSupervision": [ + { + "refAliveSupervisionIdx": 1 + } + ], + "hmRefDeadlineSupervision": [], + "hmRefLogicalSupervision": [] } ], "hmGlobalSupervision": [ @@ -76,11 +132,17 @@ "localSupervision": [ { "refLocalSupervisionIndex": 0 + }, + { + "refLocalSupervisionIndex": 1 } ], "refProcesses": [ { "index": 0 + }, + { + "index": 1 } ], "refProcessGroupStates": [ diff --git a/integration/showcases/simple_lifecycle/configs/lm_demo.json b/integration/showcases/simple_lifecycle/configs/lm_demo.json index 8477b8a0ca..09999ade7d 100644 --- a/integration/showcases/simple_lifecycle/configs/lm_demo.json +++ b/integration/showcases/simple_lifecycle/configs/lm_demo.json @@ -46,7 +46,7 @@ ] }, { - "identifier": "demo_app0_MainPG", + "identifier": "cpp_supervised_app", "uid": 0, "gid": 0, "path": "/showcases/bin/cpp_supervised_app", @@ -76,20 +76,70 @@ }, { "key": "PROCESSIDENTIFIER", - "value": "MainPG_app0" + "value": "cpp_supervised_app" }, { "key": "CONFIG_PATH", - "value": "/showcases/data/simple_lifecycle/etc/supervised_cpp_app_demo.bin" + "value": "/showcases/data/simple_lifecycle/etc/cpp_supervised_app_demo.bin" }, { "key": "IDENTIFIER", - "value": "demo/demo_application0/Port1" + "value": "cpp_supervised_app" } ], "processArgument": [ { - "argument": "-sdemo/demo_application0/Port1" + "argument": "-scpp_supervised_app" + } + ] + } + ] + }, + { + "identifier": "rust_supervised_app", + "uid": 0, + "gid": 0, + "path": "/showcases/bin/rust_supervised_app", + "numberOfRestartAttempts": 0, + "executable_reportingBehavior": "ReportsExecutionState", + "sgids": [], + "startupConfig": [ + { + "executionError": "1", + "schedulingPolicy": "SCHED_OTHER", + "schedulingPriority": "1", + "identifier": "demo_app_startup_config_1", + "enterTimeoutValue": 2000, + "exitTimeoutValue": 2000, + "terminationBehavior": "ProcessIsNotSelfTerminating", + "executionDependency": [], + "processGroupStateDependency": [ + { + "stateMachine_name": "MainPG", + "stateName": "MainPG/Startup" + } + ], + "environmentVariable": [ + { + "key": "LD_LIBRARY_PATH", + "value": "/usr/lib" + }, + { + "key": "PROCESSIDENTIFIER", + "value": "rust_supervised_app" + }, + { + "key": "CONFIG_PATH", + "value": "/showcases/data/simple_lifecycle/etc/rust_supervised_app_demo.bin" + }, + { + "key": "IDENTIFIER", + "value": "rust_supervised_app" + } + ], + "processArgument": [ + { + "argument": "-d50" } ] } diff --git a/integration/showcases/simple_lifecycle/configs/rust_supervised_app_demo.json b/integration/showcases/simple_lifecycle/configs/rust_supervised_app_demo.json new file mode 100644 index 0000000000..75367c6fb2 --- /dev/null +++ b/integration/showcases/simple_lifecycle/configs/rust_supervised_app_demo.json @@ -0,0 +1,15 @@ + +{ + "versionMajor": 8, + "versionMinor": 0, + "process": [], + "hmMonitorInterface": [ + { + "instanceSpecifier": "rust_supervised_app", + "processShortName": "rust_supervised_app", + "portPrototype": "Port", + "interfacePath": "lifecycle_rust_supervised_app", + "refProcessIndex":0 + } + ] +} diff --git a/integration/showcases/simple_lifecycle/configs/supervised_cpp_app_demo.json b/integration/showcases/simple_lifecycle/configs/supervised_cpp_app_demo.json deleted file mode 100644 index 3880ea9166..0000000000 --- a/integration/showcases/simple_lifecycle/configs/supervised_cpp_app_demo.json +++ /dev/null @@ -1,14 +0,0 @@ -{ - "versionMajor": 8, - "versionMinor": 0, - "process": [], - "hmMonitorInterface": [ - { - "instanceSpecifier": "demo/demo_application0/Port1", - "processShortName": "demo_application0", - "portPrototype": "Port1", - "interfacePath": "demo_application_0_MainPG", - "refProcessIndex":0 - } - ] -} diff --git a/integration/showcases/simple_lifecycle/lifecycle_demo.sh b/integration/showcases/simple_lifecycle/lifecycle_demo.sh index 4a97bf2fab..666568efec 100755 --- a/integration/showcases/simple_lifecycle/lifecycle_demo.sh +++ b/integration/showcases/simple_lifecycle/lifecycle_demo.sh @@ -19,7 +19,7 @@ else pkill -SIGUSR1 -f cpp_supervised_app fi -sleep 5 +sleep 6 echo "\nStep 3: Shutdown Launch Manager\n" diff --git a/integration/showcases/simple_lifecycle/simple_lifecycle.score.json b/integration/showcases/simple_lifecycle/simple_lifecycle.score.json index ab3951b51d..311c9f19d6 100644 --- a/integration/showcases/simple_lifecycle/simple_lifecycle.score.json +++ b/integration/showcases/simple_lifecycle/simple_lifecycle.score.json @@ -1,6 +1,6 @@ { "name": "Simple Health and lifecycle management example", - "description": "Example runs two applications and monitors if they are healthy. When some application is malfunctioning, this will be recorded. Examples takes ~15s", + "description": "Example runs launch_manager which is spawning two applications and monitors if they are healthy. When some application is malfunctioning, launch_manager will switch to a Recovery state and terminate both applications. Examples takes ~15s", "apps": [ { "path": "/showcases/bin/lifecycle_demo.sh", From 6d52c94e339358e5085ef35d842aedf0dd8e75c3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Thu, 12 Feb 2026 09:34:25 +0100 Subject: [PATCH 3/4] Fix bazel warning Warning about using the filename also for the gen_rule name --- integration/showcases/simple_lifecycle/BUILD | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/integration/showcases/simple_lifecycle/BUILD b/integration/showcases/simple_lifecycle/BUILD index 1b4b7d773b..ae8988f367 100644 --- a/integration/showcases/simple_lifecycle/BUILD +++ b/integration/showcases/simple_lifecycle/BUILD @@ -23,7 +23,7 @@ score_pkg_bundle( ) genrule( - name = "lm_demo.bin", + name = "gen_lm_demo.bin", srcs = ["@score_lifecycle_health//src/launch_manager_daemon:lm_flatcfg_fbs", "//showcases/simple_lifecycle/configs:lm_demo.json"], outs = ["lm_demo.bin"], tools = ["@flatbuffers//:flatc"], @@ -32,7 +32,7 @@ genrule( ) genrule( - name = "hm_demo.bin", + name = "gen_hm_demo.bin", srcs = ["@score_lifecycle_health//src/launch_manager_daemon/health_monitor_lib:hm_flatcfg_fbs", "//showcases/simple_lifecycle/configs:hm_demo.json"], outs = ["hm_demo.bin"], tools = ["@flatbuffers//:flatc"], @@ -41,7 +41,7 @@ genrule( ) genrule( - name = "cpp_supervised_app_demo.bin", + name = "gen_cpp_supervised_app_demo.bin", srcs = ["@score_lifecycle_health//src/launch_manager_daemon/health_monitor_lib:hm_flatcfg_fbs", "//showcases/simple_lifecycle/configs:cpp_supervised_app_demo.json"], outs = ["cpp_supervised_app_demo.bin"], tools = ["@flatbuffers//:flatc"], @@ -50,7 +50,7 @@ genrule( ) genrule( - name = "rust_supervised_app_demo.bin", + name = "gen_rust_supervised_app_demo.bin", srcs = ["@score_lifecycle_health//src/launch_manager_daemon/health_monitor_lib:hm_flatcfg_fbs", "//showcases/simple_lifecycle/configs:rust_supervised_app_demo.json"], outs = ["rust_supervised_app_demo.bin"], tools = ["@flatbuffers//:flatc"], From ec6e2d5861672d3f738ee4f098748291226df00d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicolas=20Fu=C3=9Fberger?= Date: Thu, 12 Feb 2026 12:58:11 +0100 Subject: [PATCH 4/4] Move showcase steps to the .score.json file --- integration/showcases/simple_lifecycle/BUILD | 2 +- .../simple_lifecycle/configs/lm_demo.json | 8 ++--- .../simple_lifecycle/lifecycle_demo.sh | 31 ------------------- .../simple_lifecycle/lifecycle_signal.sh | 18 +++++++++++ .../simple_lifecycle.score.json | 18 +++++++++-- 5 files changed, 38 insertions(+), 39 deletions(-) delete mode 100755 integration/showcases/simple_lifecycle/lifecycle_demo.sh create mode 100755 integration/showcases/simple_lifecycle/lifecycle_signal.sh diff --git a/integration/showcases/simple_lifecycle/BUILD b/integration/showcases/simple_lifecycle/BUILD index ae8988f367..0db2695e58 100644 --- a/integration/showcases/simple_lifecycle/BUILD +++ b/integration/showcases/simple_lifecycle/BUILD @@ -8,7 +8,7 @@ score_pkg_bundle( "@score_lifecycle_health//examples/cpp_supervised_app", "@score_lifecycle_health//examples/rust_supervised_app", "@score_lifecycle_health//examples/control_application:control_daemon", - ":lifecycle_demo.sh" + ":lifecycle_signal.sh" ], config_data = [ "//showcases/simple_lifecycle:simple_lifecycle.score.json", diff --git a/integration/showcases/simple_lifecycle/configs/lm_demo.json b/integration/showcases/simple_lifecycle/configs/lm_demo.json index 09999ade7d..7c79e876a8 100644 --- a/integration/showcases/simple_lifecycle/configs/lm_demo.json +++ b/integration/showcases/simple_lifecycle/configs/lm_demo.json @@ -59,8 +59,8 @@ "schedulingPolicy": "SCHED_OTHER", "schedulingPriority": "1", "identifier": "demo_app_startup_config_0", - "enterTimeoutValue": 2000, - "exitTimeoutValue": 2000, + "enterTimeoutValue": 1000, + "exitTimeoutValue": 1000, "terminationBehavior": "ProcessIsNotSelfTerminating", "executionDependency": [], "processGroupStateDependency": [ @@ -109,8 +109,8 @@ "schedulingPolicy": "SCHED_OTHER", "schedulingPriority": "1", "identifier": "demo_app_startup_config_1", - "enterTimeoutValue": 2000, - "exitTimeoutValue": 2000, + "enterTimeoutValue": 1000, + "exitTimeoutValue": 1000, "terminationBehavior": "ProcessIsNotSelfTerminating", "executionDependency": [], "processGroupStateDependency": [ diff --git a/integration/showcases/simple_lifecycle/lifecycle_demo.sh b/integration/showcases/simple_lifecycle/lifecycle_demo.sh deleted file mode 100755 index 666568efec..0000000000 --- a/integration/showcases/simple_lifecycle/lifecycle_demo.sh +++ /dev/null @@ -1,31 +0,0 @@ -#! /bin/sh - -running_on_qnx() { - [ -x "$(command -v slay)" ] -} - -echo "\nStep 1: Starting Launch Manager\n" -cd /showcases/data/simple_lifecycle -/showcases/bin/launch_manager& - -sleep 2 - -echo "\nStep 2: Make application stop reporting alive notifications\n" - -if running_on_qnx -then - slay -s SIGUSR1 -f cpp_supervised_app -else - pkill -SIGUSR1 -f cpp_supervised_app -fi - -sleep 6 - -echo "\nStep 3: Shutdown Launch Manager\n" - -if running_on_qnx -then - slay -f launch_manager -else - pkill -f launch_manager -fi diff --git a/integration/showcases/simple_lifecycle/lifecycle_signal.sh b/integration/showcases/simple_lifecycle/lifecycle_signal.sh new file mode 100755 index 0000000000..55d81c468b --- /dev/null +++ b/integration/showcases/simple_lifecycle/lifecycle_signal.sh @@ -0,0 +1,18 @@ +#! /bin/sh +# This script sends a signal to a process by name. It uses `slay` on QNX and `pkill` on other systems. +# Usage: lifecycle_signal.sh +# Example: lifecycle_signal.sh my_process SIGTERM + +running_on_qnx() { + [ -x "$(command -v slay)" ] +} + +process_name=$1 +signal=$2 + +if running_on_qnx +then + slay -s $signal -f $process_name +else + pkill -$signal -f $process_name +fi diff --git a/integration/showcases/simple_lifecycle/simple_lifecycle.score.json b/integration/showcases/simple_lifecycle/simple_lifecycle.score.json index 311c9f19d6..5b05a6b83b 100644 --- a/integration/showcases/simple_lifecycle/simple_lifecycle.score.json +++ b/integration/showcases/simple_lifecycle/simple_lifecycle.score.json @@ -1,12 +1,24 @@ { "name": "Simple Health and lifecycle management example", - "description": "Example runs launch_manager which is spawning two applications and monitors if they are healthy. When some application is malfunctioning, launch_manager will switch to a Recovery state and terminate both applications. Examples takes ~15s", + "description": "Example runs two applications and monitors if they are healthy. When some application is malfunctioning, this will be recorded. Examples takes ~15s", "apps": [ { - "path": "/showcases/bin/lifecycle_demo.sh", - "dir": "/", + "path": "/showcases/bin/launch_manager", + "dir": "/showcases/data/simple_lifecycle", "args": [], "env": {} + }, + { + "path": "/showcases/bin/lifecycle_signal.sh", + "args": ["cpp_supervised_app", "SIGUSR1"], + "env": {}, + "delay": 2 + }, + { + "path": "/showcases/bin/lifecycle_signal.sh", + "args": ["launch_manager", "SIGTERM"], + "env": {}, + "delay": 6 } ] }