Skip to content

Commit 9f85924

Browse files
sramzy1sramzy1
authored andcommitted
handling shutdown and termination signallingin all signalling modes
1 parent 05702d0 commit 9f85924

Some content is hidden

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

42 files changed

+861
-216
lines changed

BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ setup_starpls(
2323
copyright_checker(
2424
name = "copyright",
2525
srcs = [
26-
"src",
2726
"tests",
2827
"//:BUILD",
2928
"//:MODULE.bazel",

Cargo.lock

Lines changed: 64 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

README.md

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ Install *bytehound* with the following commands:
8989

9090
```sh
9191
wget https://github.com/koute/bytehound/releases/download/0.11.0/bytehound-x86_64-unknown-linux-gnu.tgz
92-
tar xzf bytehound-x86_64-unknown-linux-gnu.tgz bytehound libbytehound.so
92+
tar xzf bytehound-x86_64-unknown-linux-gnu.tgz bytehound libbytehound.so
9393
mv bytehound libbytehound.so $HOME/.cargo/bin
9494
```
9595

@@ -113,5 +113,3 @@ bytehound server memory-profiling_*.dat
113113

114114
Click on the [link](http://127.0.0.1:8080) in the output to open the browser and
115115
see the results. Setup ssh port forwarding if needed when working remote (`ssh -L 8080:localhost:8080 host`).
116-
117-

examples/rust/cycle-benchmark/src/bin/cycle_bench.rs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ mod direct_mpsc {
179179

180180
let agent_id = params.agent_id;
181181
PrimaryConfig {
182+
id: agent_id,
182183
cycle_time: params.feo_cycle_time,
183184
activity_dependencies: app_config.activity_dependencies(),
184185
// With only one agent, we cannot attach a recorder
@@ -228,12 +229,14 @@ mod direct_sockets {
228229
) -> PrimaryConfig {
229230
let agent_id = params.agent_id;
230231
PrimaryConfig {
232+
id: agent_id,
231233
cycle_time: params.feo_cycle_time,
232234
activity_dependencies: app_config.activity_dependencies(),
233235
recorder_ids: app_config.recorders(),
234236
worker_assignments: app_config.worker_assignments().remove(&agent_id).unwrap(),
235237
timeout: Duration::from_secs(10),
236238
endpoint: endpoint(&app_config, signalling),
239+
activity_agent_map: app_config.activity_worker_map().iter().map(|(act_id, w_id)| (*act_id, app_config.worker_agent_map().get(w_id).copied().unwrap())).collect(),
237240
}
238241
}
239242

examples/rust/mini-adas/BUILD.bazel

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ rust_library(
2626
],
2727
crate_features = [
2828
"com_iox2",
29-
"signalling_relayed_tcp",
29+
"signalling_direct_tcp",
3030
],
3131
crate_name = "mini_adas",
3232
proc_macro_deps = [
@@ -59,7 +59,7 @@ rust_library(
5959
crate_features = [
6060
"com_iox2",
6161
"recording",
62-
"signalling_relayed_tcp",
62+
"signalling_direct_tcp",
6363
],
6464
crate_name = "mini_adas",
6565
proc_macro_deps = [
@@ -87,7 +87,7 @@ rust_binary(
8787
srcs = [
8888
"src/bin/adas_primary.rs",
8989
],
90-
crate_features = ["signalling_relayed_tcp"],
90+
crate_features = ["signalling_direct_tcp"],
9191
visibility = ["//visibility:public"],
9292
deps = [
9393
":libmini_adas_rust",
@@ -104,7 +104,7 @@ rust_binary(
104104
srcs = [
105105
"src/bin/adas_secondary.rs",
106106
],
107-
crate_features = ["signalling_relayed_tcp"],
107+
crate_features = ["signalling_direct_tcp"],
108108
visibility = ["//visibility:public"],
109109
deps = [
110110
":libmini_adas_rust",
@@ -123,7 +123,7 @@ rust_binary(
123123
],
124124
crate_features = [
125125
"recording",
126-
"signalling_relayed_tcp",
126+
"signalling_direct_tcp",
127127
],
128128
visibility = ["//visibility:public"],
129129
deps = [

examples/rust/mini-adas/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ com_iox2 = ["feo-com/ipc_iceoryx2"]
3333
com_linux_shm = ["feo-com/ipc_linux_shm"]
3434
default = ["com_iox2", "signalling_relayed_tcp"]
3535
signalling_direct_mpsc = []
36-
signalling_direct_tcp = []
36+
signalling_direct_tcp = ["com_iox2"]
3737
signalling_direct_unix = []
3838
signalling_relayed_tcp = []
3939
signalling_relayed_unix = []

examples/rust/mini-adas/README.md

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -93,5 +93,19 @@ cargo run --no-default-features --features signalling_direct_tcp --bin adas_seco
9393
cargo run --no-default-features --features signalling_direct_tcp --bin adas_secondary 2
9494
```
9595

96+
### Direct Mode with a Recorder
97+
98+
To run with a recorder in direct mode.
99+
100+
```sh
101+
# Use 400ms cycle time and wait for recorder 900
102+
cargo run --no-default-features --features "signalling_direct_tcp,com_iox2" --bin adas_primary -- 400 900
103+
```
104+
105+
```sh
106+
# Start recorder with ID 900 in direct mode
107+
cargo run --no-default-features --features "signalling_direct_tcp,recording,com_iox2" --bin adas_recorder -- 900
108+
```
109+
96110
Note that for mpsc-only signalling, there can be only a primary process without
97-
any secondaries or recorders, because mpsc does not support inter-process signalling.
111+
any secondaries or recorders, because mpsc does not support inter-process signalling.

examples/rust/mini-adas/src/activities/components.rs

Lines changed: 21 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,9 @@ impl Activity for Camera {
9898
}
9999

100100
#[instrument(name = "Camera shutdown")]
101-
fn shutdown(&mut self) {}
101+
fn shutdown(&mut self) {
102+
debug!("Shutting down Camera activity {}", self.activity_id);
103+
}
102104
}
103105

104106
/// Radar activity
@@ -161,7 +163,9 @@ impl Activity for Radar {
161163
}
162164

163165
#[instrument(name = "Radar shutdown")]
164-
fn shutdown(&mut self) {}
166+
fn shutdown(&mut self) {
167+
debug!("Shutting down Radar activity {}", self.activity_id);
168+
}
165169
}
166170

167171
/// Neural network activity
@@ -251,7 +255,9 @@ impl Activity for NeuralNet {
251255
}
252256

253257
#[instrument(name = "NeuralNet shutdown")]
254-
fn shutdown(&mut self) {}
258+
fn shutdown(&mut self) {
259+
debug!("Shutting down NeuralNet activity {}", self.activity_id);
260+
}
255261
}
256262

257263
/// Emergency braking activity
@@ -328,7 +334,9 @@ impl Activity for EmergencyBraking {
328334
}
329335

330336
#[instrument(name = "EmergencyBraking shutdown")]
331-
fn shutdown(&mut self) {}
337+
fn shutdown(&mut self) {
338+
debug!("Shutting down EmergencyBraking activity {}", self.activity_id);
339+
}
332340
}
333341

334342
/// Brake controller activity
@@ -378,7 +386,9 @@ impl Activity for BrakeController {
378386
}
379387

380388
#[instrument(name = "BrakeController shutdown")]
381-
fn shutdown(&mut self) {}
389+
fn shutdown(&mut self) {
390+
debug!("Shutting down BrakeController activity {}", self.activity_id);
391+
}
382392
}
383393

384394
/// Environment renderer activity
@@ -422,7 +432,9 @@ impl Activity for EnvironmentRenderer {
422432
}
423433

424434
#[instrument(name = "EnvironmentRenderer shutdown")]
425-
fn shutdown(&mut self) {}
435+
fn shutdown(&mut self) {
436+
debug!("Shutting down EnvironmentRenderer activity {}", self.activity_id);
437+
}
426438
}
427439

428440
/// Steering controller activity
@@ -470,7 +482,9 @@ impl Activity for SteeringController {
470482
}
471483

472484
#[instrument(name = "SteeringController shutdown")]
473-
fn shutdown(&mut self) {}
485+
fn shutdown(&mut self) {
486+
debug!("Shutting down SteeringController activity {}", self.activity_id);
487+
}
474488
}
475489

476490
/// Create an activity input.

0 commit comments

Comments
 (0)