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
2 changes: 1 addition & 1 deletion .github/workflows/build_and_test_on_every_pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,4 +53,4 @@ jobs:
done < ci/showcase_targets_run.txt
- name: Feature Integration Tests
run: |
bazel run --config bl-x86_64-linux //feature_integration_tests/python_test_cases:fit
bazel test --config bl-x86_64-linux //feature_integration_tests/python_test_cases:fit
4 changes: 2 additions & 2 deletions feature_integration_tests/rust_test_scenarios/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ rust_binary(
"manual",
],
deps = [
"@score_orchestrator//src/kyron:libkyron",
"@score_orchestrator//src/kyron-foundation:libkyron_foundation",
"@score_kyron//src/kyron:libkyron",
"@score_kyron//src/kyron-foundation:libkyron_foundation",
"@score_orchestrator//src/orchestration:liborchestration",
"@score_persistency//src/rust/rust_kvs:rust_kvs",
"@score_test_scenarios//test_scenarios_rust:test_scenarios_rust",
Expand Down
13 changes: 6 additions & 7 deletions feature_showcase/rust/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ rust_binary(
name = "kyron_example",
srcs = glob(["kyron/**/*.rs"]),
deps = [
"@score_orchestrator//src/kyron:libkyron",
"@score_orchestrator//src/kyron-foundation:libkyron_foundation",
"@score_crates//:tracing",
"@score_kyron//src/kyron:libkyron",
"@score_kyron//src/kyron-foundation:libkyron_foundation",
"@score_crates//:tracing_subscriber",
],
visibility = ["//visibility:public"],
)
Expand All @@ -28,11 +28,10 @@ rust_binary(
name = "orch_per_example",
srcs = glob(["orchestration_persistency/**/*.rs"]),
deps = [
"@score_orchestrator//src/kyron:libkyron",
"@score_orchestrator//src/kyron-foundation:libkyron_foundation",
"@score_kyron//src/kyron:libkyron",
"@score_kyron//src/kyron-foundation:libkyron_foundation",
"@score_orchestrator//src/orchestration:liborchestration",
"@score_orchestrator//src/logging_tracing:liblogging_tracing",
"@score_crates//:tracing",
"@score_kyron//src/logging_tracing:liblogging_tracing",
"@score_persistency//src/rust/rust_kvs:rust_kvs",
],
visibility = ["//visibility:public"],
Expand Down
5 changes: 4 additions & 1 deletion feature_showcase/rust/kyron/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ use kyron_foundation::prelude::*;
/// For more visit https://github.com/eclipse-score/orchestrator
#[kyron::main]
async fn main() {
tracing_subscriber::fmt().with_target(false).with_max_level(Level::INFO).init();
tracing_subscriber::fmt()
.with_target(false)
.with_max_level(Level::INFO)
.init();

let (sender, mut receiver) = create_channel_default::<u32>();

Expand Down
97 changes: 65 additions & 32 deletions feature_showcase/rust/orchestration_persistency/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,11 @@ use std::time::Duration;

use kyron::runtime::*;
use kyron_foundation::prelude::*;
use logging_tracing::TracingLibraryBuilder;
use logging_tracing::LogAndTraceBuilder;
use orchestration::{
actions::{invoke::Invoke, sequence::SequenceBuilder, sync::SyncBuilder, trigger::TriggerBuilder},
actions::{
invoke::Invoke, sequence::SequenceBuilder, sync::SyncBuilder, trigger::TriggerBuilder,
},
api::{design::Design, Orchestration},
common::DesignConfig,
prelude::InvokeResult,
Expand All @@ -34,7 +36,6 @@ use rust_kvs::prelude::*;
// which starts the object detection component. Persistency is demonstrated using a key-value store during shutdown.
// The orchestration is run using the Kyron async runtime, and the program chains are executed concurrently.


const CAMERA_IMG_READY: &str = "CameraImageReadyEvent";
const CAMERA_IMG_PROCESSED: &str = "CameraImageProcessedEvent";

Expand All @@ -56,8 +57,8 @@ async fn on_shutdown() -> InvokeResult {
// Instance ID for KVS object instances.
let instance_id = InstanceId(0);
let builder = KvsBuilder::new(instance_id)
.dir("./")
.kvs_load(KvsLoad::Optional);
.dir("./")
.kvs_load(KvsLoad::Optional);
let kvs = builder.build().unwrap();

kvs.set_value("number", 123.0).unwrap();
Expand All @@ -74,41 +75,61 @@ fn camera_processing_component_design() -> Result<Design, CommonErrors> {
// Register events and invoke actions in design so it knows how to build task chains
design.register_event(CAMERA_IMG_READY.into())?;
design.register_event(CAMERA_IMG_PROCESSED.into())?;
let on_camera_image_ready_tag = design.register_invoke_async("on_camera_image_ready".into(), on_camera_image_ready)?;
let on_camera_image_ready_tag =
design.register_invoke_async("on_camera_image_ready".into(), on_camera_image_ready)?;

// Create a program describing task chain
design.add_program("CameraProcessingProgram", move |design_instance, builder| {
builder.with_run_action(
SequenceBuilder::new()
.with_step(SyncBuilder::from_design(CAMERA_IMG_READY, design_instance))
.with_step(Invoke::from_tag(&on_camera_image_ready_tag, design_instance.config()))
.with_step(TriggerBuilder::from_design(CAMERA_IMG_PROCESSED, design_instance))
.build(),
);
Ok(())
});
design.add_program(
"CameraProcessingProgram",
move |design_instance, builder| {
builder.with_run_action(
SequenceBuilder::new()
.with_step(SyncBuilder::from_design(CAMERA_IMG_READY, design_instance))
.with_step(Invoke::from_tag(
&on_camera_image_ready_tag,
design_instance.config(),
))
.with_step(TriggerBuilder::from_design(
CAMERA_IMG_PROCESSED,
design_instance,
))
.build(),
);
Ok(())
},
);

Ok(design)
}

fn detect_object_component_design() -> Result<Design, CommonErrors> {
let mut design = Design::new("DetectObjectDesign".into(), DesignConfig::default());

// Register events and invoke actions in design so it knows how to build task chains
// Register events and invoke actions in design so it knows how to build task chains
design.register_event(CAMERA_IMG_PROCESSED.into())?;
let detect_objects_tag = design.register_invoke_async("detect_objects".into(), detect_objects)?;
let detect_objects_tag =
design.register_invoke_async("detect_objects".into(), detect_objects)?;
let on_shutdown_tag = design.register_invoke_async("on_shutdown".into(), on_shutdown)?;

// Create a program describing task chain
design.add_program("DetectObjectProgram", move |design_instance, builder| {
builder.with_run_action(
SequenceBuilder::new()
.with_step(SyncBuilder::from_design(CAMERA_IMG_PROCESSED, design_instance))
.with_step(Invoke::from_tag(&detect_objects_tag, design_instance.config()))
.build(),
).with_stop_action(
Invoke::from_tag(&on_shutdown_tag, design_instance.config()), Duration::from_secs(2)
);
builder
.with_run_action(
SequenceBuilder::new()
.with_step(SyncBuilder::from_design(
CAMERA_IMG_PROCESSED,
design_instance,
))
.with_step(Invoke::from_tag(
&detect_objects_tag,
design_instance.config(),
))
.build(),
)
.with_stop_action(
Invoke::from_tag(&on_shutdown_tag, design_instance.config()),
Duration::from_secs(2),
);
Ok(())
});

Expand All @@ -117,18 +138,30 @@ fn detect_object_component_design() -> Result<Design, CommonErrors> {

fn main() {
// Setup any logging framework you want to use.
let mut logger = TracingLibraryBuilder::new().global_log_level(Level::INFO).enable_logging(true).build();

logger.init_log_trace();
let logger = LogAndTraceBuilder::new()
.global_log_level(logging_tracing::Level::INFO)
.enable_logging(true)
.build();
// logger.init_log_trace();

// Create runtime
let (builder, _engine_id) = kyron::runtime::RuntimeBuilder::new().with_engine(ExecutionEngineBuilder::new().task_queue_size(256).workers(2));
let (builder, _engine_id) = kyron::runtime::RuntimeBuilder::new().with_engine(
ExecutionEngineBuilder::new()
.task_queue_size(256)
.workers(2),
);
let mut runtime = builder.build().unwrap();

// Build Orchestration
let mut orch = Orchestration::new()
.add_design(camera_processing_component_design().expect("Failed to create camera_processing_component_design"))
.add_design(detect_object_component_design().expect("Failed to create detect_object_component_design"))
.add_design(
camera_processing_component_design()
.expect("Failed to create camera_processing_component_design"),
)
.add_design(
detect_object_component_design()
.expect("Failed to create detect_object_component_design"),
)
.design_done();

// Specify deployment information, ie. which event is local, which timer etc
Expand Down
4 changes: 2 additions & 2 deletions integration_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,9 @@ declare -A BUILD_TARGET_GROUPS=(
[score_baselibs]="@score_baselibs//score/..."
[score_communication]="@score_communication//score/mw/com:com"
[score_persistency]="@score_persistency//src/cpp/src/... @score_persistency//src/rust/..."
#[score_logging]="@score_logging//src/..."
[score_kyron]="@score_kyron//src/..."
[score_orchestrator]="@score_orchestrator//src/..."
[score_test_scenarios]="@score_test_scenarios//..."
[score_test_scenarios]="@score_test_scenarios//test_scenarios_rust:test_scenarios_rust @score_test_scenarios//test_scenarios_cpp:test_scenarios_cpp"
[score_feo]="-- @score_feo//... -@score_feo//:docs -@score_feo//:ide_support -@score_feo//:needs_json"
)

Expand Down
27 changes: 14 additions & 13 deletions score_modules.MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,21 @@ single_version_override(
)

bazel_dep(name = "score_persistency")
single_version_override(
git_override(
module_name = "score_persistency",
version = "0.2.1",
remote = "https://github.com/qorix-group/persistency.git",
commit = "49089f1ac9d232f09eb65ca086b92f67e75aaff8",
)

bazel_dep(name = "score_orchestrator")
single_version_override(
module_name = "score_orchestrator",
version = "0.0.4",
)

bazel_dep(name = "score_kyron")
single_version_override(
module_name = "score_kyron",
version = "0.0.3",
)

Expand All @@ -42,9 +49,10 @@ single_version_override(
)

bazel_dep(name = "score_platform")
single_version_override(
git_override(
module_name = "score_platform",
version = "0.5.0",
remote = "https://github.com/eclipse-score/score.git",
commit = "45faa6781b5c7d292d885d4e2ad95eaf21c925c5",
)

bazel_dep(name = "score_bazel_platforms")
Expand All @@ -56,7 +64,7 @@ single_version_override(
bazel_dep(name = "score_test_scenarios")
single_version_override(
module_name = "score_test_scenarios",
version = "0.3.0",
version = "0.3.1",
)

bazel_dep(name = "score_docs_as_code")
Expand All @@ -68,18 +76,11 @@ single_version_override(
bazel_dep(name = "score_process")
single_version_override(
module_name = "score_process",
version = "1.3.2",
version = "1.4.0",
)

bazel_dep(name = "score_feo", version = "1.0.2")
single_version_override(
module_name = "score_feo",
version = "1.0.2",
)

bazel_dep(name = "score_kyron")
git_override(
module_name = "score_kyron",
remote = "https://github.com/eclipse-score/kyron.git",
commit = "c5837ac6612a5ebf91cd016775f2d3ee85ed6892",
)