Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
26 changes: 19 additions & 7 deletions integration/showcases/simple_lifecycle/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand All @@ -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"],
Expand All @@ -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"],
Expand All @@ -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"],
)

3 changes: 2 additions & 1 deletion integration/showcases/simple_lifecycle/configs/BUILD
Original file line number Diff line number Diff line change
@@ -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"
])
Original file line number Diff line number Diff line change
@@ -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
}
]
}
84 changes: 73 additions & 11 deletions integration/showcases/simple_lifecycle/configs/hm_demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": [
{
Expand All @@ -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,
Expand All @@ -52,21 +81,48 @@
"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
}
],
"hmRefDeadlineSupervision": [],
"hmRefLogicalSupervision": []
},
{
"ruleContextKey": "LocalSupervision_rust_supervised_app",
"infoRefInterfacePath": "rust_supervised_app",
"hmRefAliveSupervision": [
{
"refAliveSupervisionIdx": 1
}
],
"hmRefDeadlineSupervision": [],
"hmRefLogicalSupervision": []
}
],
"hmGlobalSupervision": [
Expand All @@ -76,11 +132,17 @@
"localSupervision": [
{
"refLocalSupervisionIndex": 0
},
{
"refLocalSupervisionIndex": 1
}
],
"refProcesses": [
{
"index": 0
},
{
"index": 1
}
],
"refProcessGroupStates": [
Expand Down
67 changes: 56 additions & 11 deletions integration/showcases/simple_lifecycle/configs/lm_demo.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
]
},
{
"identifier": "demo_app0_MainPG",
"identifier": "cpp_supervised_app",
"uid": 0,
"gid": 0,
"path": "/showcases/bin/cpp_supervised_app",
Expand All @@ -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",
Expand All @@ -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"
}
]
}
Expand Down
Original file line number Diff line number Diff line change
@@ -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
}
]
}

This file was deleted.

18 changes: 18 additions & 0 deletions integration/showcases/simple_lifecycle/lifecycle_signal.sh
Original file line number Diff line number Diff line change
@@ -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 <process_name> <signal>
# 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
Loading
Loading