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
6 changes: 2 additions & 4 deletions images/autosd_x86_64/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,11 @@ rpm_package(
version = "0.6.0",
binaries = [
"//showcases/cli:cli",
"//showcases/kyron:kyron_example",
"//showcases/orchestration_persistency:orch_per_example",
"//showcases/orchestration_persistency:orch_per_example",
],
config_dir = "/etc/score",
data = [
"//showcases/kyron:kyron.score.json",
"//showcases/orchestration_persistency:orch_per.score.json"
"//showcases/orchestration_persistency:orch_per.score.json"
],
data_dir = "/usr/share/score/examples",
)
Expand Down
2 changes: 2 additions & 0 deletions images/qnx_x86_64/build/init.build
Original file line number Diff line number Diff line change
Expand Up @@ -95,5 +95,7 @@ libslog2.so.1 # System logging library (slog2_* functions)
devb-eide # Block device driver for IDE/SATA hard drives and SSDs
# Required for mounting QNX6 file systems from disk partitions

# Orchestrator example needed
[type=link] /data=/tmp_ram

[+include] ${MAIN_BUILD_FILE_DIR}/system.build # Include additional system build configurations
2 changes: 1 addition & 1 deletion score_starter
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ mEntries = [
("Run Elektrobit Corbos aarch64 QEMU",
"bazel --output_base=build/eb-aarch64 build --config eb-aarch64 //images/ebclfsa_aarch64/scrample_integration:run", "eb-aarch64"),
("Run Autosd x86_64 QEMU",
"bazel --output_base=build/autosd-x86_64 build --config autosd-x86_64 //images/autosd_x86_64:image", "autosd-x86_64"),
"bazel --output_base=build/autosd-x86_64 run --config autosd-x86_64 //images/autosd_x86_64:run", "autosd-x86_64"),
("Exit", "exit 0", "exit"),
]

Expand Down
4 changes: 2 additions & 2 deletions showcases/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ score_pkg_bundle(
name = "showcases_all",
bins = ["//showcases/cli" ],
other_package_files = [
"//showcases/standalone:comm_pkg_files",
"//showcases/kyron:kyron_pkg_files",
"//showcases/standalone:comm_pkg_files",
"//showcases/standalone:kyron_pkg_files",
"//showcases/orchestration_persistency:orch_per_pkg_files",
"//showcases/simple_lifecycle:simple_lifecycle_pkg_files",
],
Expand Down
30 changes: 29 additions & 1 deletion showcases/cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,17 +22,45 @@ To make this work each example shall deploy configuration file `name.score.json`
"env": {
// env to be used when running
},
"delay": "number" // Optional delay between two consecutive apps
"delay": "number" // Optional delay between two consecutive apps
},
{
// ...
}
]

}
```

Each example can run multiple executables, providing additional `apps` configs. This will be started one after another but not blocking each-other.

Alternatively, the configuration file can contain a top-level array of configs, allowing multiple examples to be defined in a single file:

```json
[
{
"name": "First example",
"description": "Description of first example",
"apps": [
{
"path": "exec_path",
"args": [],
"env": {}
}
]
},
{
"name": "Second example",
"description": "Description of second example",
"apps": [
{
"path": "exec_path",
"args": [],
"env": {}
}
]
}
]
```

You can customize where to look for examples using env `SCORE_CLI_INIT_DIR`.
12 changes: 10 additions & 2 deletions showcases/cli/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -111,9 +111,17 @@ fn visit_dir(dir: &Path, configs: &mut Vec<ScoreConfig>) -> Result<()> {
if is_score_file(&path) {
let content = fs::read_to_string(&path)
.with_context(|| format!("Failed reading {:?}", path))?;
let config: ScoreConfig = serde_json::from_str(&content)
let value: serde_json::Value = serde_json::from_str(&content)
.with_context(|| format!("Invalid JSON in {:?}", path))?;
configs.push(config);
if value.is_array() {
let found: Vec<ScoreConfig> = serde_json::from_value(value)
.with_context(|| format!("Invalid JSON array in {:?}", path))?;
configs.extend(found);
} else {
let config: ScoreConfig = serde_json::from_value(value)
.with_context(|| format!("Invalid JSON in {:?}", path))?;
configs.push(config);
}
}
}
Ok(())
Expand Down
22 changes: 0 additions & 22 deletions showcases/kyron/BUILD

This file was deleted.

13 changes: 0 additions & 13 deletions showcases/kyron/kyron.score.json

This file was deleted.

50 changes: 0 additions & 50 deletions showcases/kyron/main.rs

This file was deleted.

15 changes: 14 additions & 1 deletion showcases/orchestration_persistency/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ async fn on_shutdown() -> InvokeResult {
// Configure backend with directory path (workaround: KvsBuilder::dir() not available in Rust)
// change back to dir, if https://github.com/eclipse-score/persistency/issues/222 is resolved.
let backend = JsonBackendBuilder::new()
.working_dir(PathBuf::from("./"))
.working_dir(PathBuf::from("/tmp"))
.build();

let builder = KvsBuilder::new(instance_id)
Expand All @@ -75,6 +75,19 @@ async fn on_shutdown() -> InvokeResult {

kvs.flush().unwrap();

let instance_id = kvs.parameters().instance_id;
let snapshot_id = SnapshotId(0);
match kvs.parameters().backend.as_any().downcast_ref(){
Some(backend ) => {
let backend = backend as &JsonBackend;
let filename = backend.kvs_file_path(instance_id, snapshot_id);
info!("KVS snapshot saved to file: {:?}", filename);
},
None => {

},
};

Ok(())
}

Expand Down
2 changes: 1 addition & 1 deletion showcases/orchestration_persistency/orch_per.score.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "Orchestration persistency - Kyron example",
"name": "Orchestration persistency example",
"description": "Example for running orchestration graph with Kyron runtime and saving the state to disk",
"apps":[
{
Expand Down
10 changes: 10 additions & 0 deletions showcases/standalone/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,13 @@ score_pkg_bundle(
"//showcases/standalone:com.score.json",
],
)

score_pkg_bundle(
name = "kyron",
package_dir = "standalone",
bins = ["@score_kyron//src/kyron:select", "@score_kyron//src/kyron:safety_task", "@score_kyron//src/kyron:main_macro"], # TODO: kyron shall have public examples in examples folder

config_data = [
"//showcases/standalone:kyron.score.json",
],
)
35 changes: 35 additions & 0 deletions showcases/standalone/kyron.score.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
[
{
"name": "Kyron select example",
"description": "Example for select! macro using safe async runtime",
"apps": [
{
"path": "/showcases/bin/select",
"args": [],
"env": {}
}
]
},
{
"name": "Kyron safety task example",
"description": "Example assuring that errors in safety task will always get reaction runtime even if worker can be blocked",
"apps": [
{
"path": "/showcases/bin/safety_task",
"args": [],
"env": {}
}
]
},
{
"name": "Kyron basic example",
"description": "Example running async code via main! macro",
"apps": [
{
"path": "/showcases/bin/main_macro",
"args": [],
"env": {}
}
]
}
]
Loading