diff --git a/integration/showcases/simple_lifecycle/BUILD b/integration/showcases/simple_lifecycle/BUILD index fd17ee51a0..0db2695e58 100644 --- a/integration/showcases/simple_lifecycle/BUILD +++ b/integration/showcases/simple_lifecycle/BUILD @@ -6,7 +6,9 @@ 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_signal.sh" ], config_data = [ "//showcases/simple_lifecycle:simple_lifecycle.score.json", @@ -15,12 +17,13 @@ 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", + ":cpp_supervised_app_demo.bin": "etc/cpp_supervised_app_demo.bin", + ":rust_supervised_app_demo.bin": "etc/rust_supervised_app_demo.bin", }, ) 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"], @@ -29,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"], @@ -38,11 +41,20 @@ 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 = "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"], - cmd = "$(location @flatbuffers//:flatc) --binary $(SRCS) && mv supervised_app_demo.bin $(location supervised_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 = "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"], + 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 cb7ef56a8a..7c79e876a8 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", @@ -59,15 +59,60 @@ "schedulingPolicy": "SCHED_OTHER", "schedulingPriority": "1", "identifier": "demo_app_startup_config_0", - "enterTimeoutValue": 2000, - "exitTimeoutValue": 2000, + "enterTimeoutValue": 1000, + "exitTimeoutValue": 1000, "terminationBehavior": "ProcessIsNotSelfTerminating", - "executionDependency": [ + "executionDependency": [], + "processGroupStateDependency": [ + { + "stateMachine_name": "MainPG", + "stateName": "MainPG/Startup" + } + ], + "environmentVariable": [ + { + "key": "LD_LIBRARY_PATH", + "value": "/usr/lib/" + }, + { + "key": "PROCESSIDENTIFIER", + "value": "cpp_supervised_app" + }, { - "stateName": "Running", - "targetProcess_identifier": "/healthmonitorApp/healthmonitor" + "key": "CONFIG_PATH", + "value": "/showcases/data/simple_lifecycle/etc/cpp_supervised_app_demo.bin" + }, + { + "key": "IDENTIFIER", + "value": "cpp_supervised_app" } ], + "processArgument": [ + { + "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": 1000, + "exitTimeoutValue": 1000, + "terminationBehavior": "ProcessIsNotSelfTerminating", + "executionDependency": [], "processGroupStateDependency": [ { "stateMachine_name": "MainPG", @@ -77,24 +122,24 @@ "environmentVariable": [ { "key": "LD_LIBRARY_PATH", - "value": "/usr/lib/" + "value": "/usr/lib" }, { "key": "PROCESSIDENTIFIER", - "value": "MainPG_app0" + "value": "rust_supervised_app" }, { "key": "CONFIG_PATH", - "value": "/showcases/data/simple_lifecycle/etc/supervised_app_demo.bin" + "value": "/showcases/data/simple_lifecycle/etc/rust_supervised_app_demo.bin" }, { "key": "IDENTIFIER", - "value": "demo/demo_application0/Port1" + "value": "rust_supervised_app" } ], "processArgument": [ { - "argument": "-sdemo/demo_application0/Port1" + "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_app_demo.json b/integration/showcases/simple_lifecycle/configs/supervised_app_demo.json deleted file mode 100644 index 3880ea9166..0000000000 --- a/integration/showcases/simple_lifecycle/configs/supervised_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_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 4adfd429bd..5b05a6b83b 100644 --- a/integration/showcases/simple_lifecycle/simple_lifecycle.score.json +++ b/integration/showcases/simple_lifecycle/simple_lifecycle.score.json @@ -9,16 +9,16 @@ "env": {} }, { - "path": "pkill", - "args": ["-f", "cpp_supervised_app", "-SIGUSR1"], + "path": "/showcases/bin/lifecycle_signal.sh", + "args": ["cpp_supervised_app", "SIGUSR1"], "env": {}, - "delay": 5 + "delay": 2 }, { - "path": "pkill", - "args": ["-f", "launch_manager"], + "path": "/showcases/bin/lifecycle_signal.sh", + "args": ["launch_manager", "SIGTERM"], "env": {}, - "delay": 2 + "delay": 6 } ] }