diff --git a/All.sln b/All.sln index 0d8a575e7..af0c5dbd3 100644 --- a/All.sln +++ b/All.sln @@ -125,6 +125,7 @@ EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{92C02EAF-93FB-4A2C-A235-8541D893163C}" ProjectSection(SolutionItems) = preProject scripts\macos\generate_grpc_models.sh = scripts\macos\generate_grpc_models.sh + scripts\windows\generate_grpc_models.ps1 = scripts\windows\generate_grpc_models.ps1 EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "misc", "misc", "{2918C7E3-3FC8-48A5-ADDF-8358E888B40C}" diff --git a/Ficus/docker/run/Run.RustFicusBackend.Dockerfile b/Ficus/docker/run/Run.RustFicusBackend.Dockerfile index efd4daa6c..bf4d31c46 100644 --- a/Ficus/docker/run/Run.RustFicusBackend.Dockerfile +++ b/Ficus/docker/run/Run.RustFicusBackend.Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.92.0 as build +FROM rust:1.93.0 as build RUN apt update -y && apt upgrade -y RUN apt-get update -y diff --git a/Ficus/docker/tests/Tests.Rust.Dockerfile b/Ficus/docker/tests/Tests.Rust.Dockerfile index 602cd5f18..70287f3fe 100644 --- a/Ficus/docker/tests/Tests.Rust.Dockerfile +++ b/Ficus/docker/tests/Tests.Rust.Dockerfile @@ -1,4 +1,4 @@ -FROM rust:1.92.0 as build +FROM rust:1.93.0 as build RUN apt update -y && apt upgrade -y RUN apt-get update -y diff --git a/Ficus/src/python/infra/generate_models.py b/Ficus/src/python/infra/generate_models.py index 763909631..44331cf49 100644 --- a/Ficus/src/python/infra/generate_models.py +++ b/Ficus/src/python/infra/generate_models.py @@ -15,7 +15,11 @@ def generate_models(): os.mkdir(models_dir) - python = '/usr/local/bin/python3' + if os.name == 'nt': + python = 'python' + else: + python = '/usr/local/bin/python3' + os.popen(f'{python} -m pip install grpcio-tools').read() packages = [] diff --git a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs index 6f9aa8d7e..c35900f10 100644 --- a/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs +++ b/Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs @@ -9,23 +9,14 @@ use crate::{ }, }; use chrono::{DateTime, Utc}; -use std::{ - collections::HashMap, - fmt::{Debug, Formatter}, - sync::Arc, -}; +use std::{collections::HashMap, fmt::Debug, sync::Arc}; +#[derive(Debug)] pub struct XesEventImpl { event_base: EventBase, payload: Option, EventPayloadValue>>, } -impl Debug for XesEventImpl { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.write_str(self.name_pointer()) - } -} - impl XesEventImpl { pub fn new_all_fields(name: Arc, timestamp: DateTime, payload: Option, EventPayloadValue>>) -> Self { Self { diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs index 6284d0a5b..1fe81f126 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/discovery.rs @@ -15,7 +15,6 @@ use getset::{Getters, MutGetters}; use std::{ cell::RefCell, collections::HashMap, - error::Error, fmt::{Debug, Display, Formatter}, ops::Deref, rc::Rc, @@ -74,16 +73,11 @@ pub struct TraceThreadEvent { stamp: i64, } +#[derive(Debug)] pub enum LogThreadsDiagramError { NotSupportedEventStamp, } -impl Debug for LogThreadsDiagramError { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - Display::fmt(self, f) - } -} - impl Display for LogThreadsDiagramError { fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { match self { @@ -92,8 +86,6 @@ impl Display for LogThreadsDiagramError { } } -impl Error for LogThreadsDiagramError {} - impl From for PipelinePartExecutionError { fn from(val: LogThreadsDiagramError) -> Self { PipelinePartExecutionError::Raw(RawPartExecutionError::new(val.to_string())) diff --git a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs index 927db07ec..ce7e99818 100644 --- a/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs +++ b/Ficus/src/rust/ficus/src/features/discovery/timeline/software_data/extractors/core.rs @@ -4,7 +4,6 @@ use crate::{ }; use std::{ cell::RefCell, - error::Error, fmt::{Debug, Display, Formatter}, rc::Rc, str::FromStr, @@ -28,8 +27,6 @@ impl Display for SoftwareDataExtractionError { } } -impl Error for SoftwareDataExtractionError {} - pub trait EventGroupSoftwareDataExtractor { fn extract(&self, software_data: &mut SoftwareData, event_group: &EventGroup) -> Result<(), SoftwareDataExtractionError> { let events = event_group diff --git a/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs b/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs index 7dfdb0728..8694e5ae0 100644 --- a/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/activities_parts.rs @@ -34,7 +34,7 @@ use crate::{ NARROW_ACTIVITIES_KEY, PATH_KEY, PATTERNS_DISCOVERY_STRATEGY_KEY, PATTERNS_KEY, PATTERNS_KIND_KEY, PIPELINE_KEY, REGEX_KEY, REGEXES_KEY, REPEAT_SETS_KEY, TRACE_ACTIVITIES_KEY, UNDEF_ACTIVITY_HANDLING_STRATEGY_KEY, UNDERLYING_EVENTS_COUNT_KEY, }, - pipeline_parts::PipelineParts, + pipeline_parts::{PIPELINE_PARTS, PipelineParts}, }, utils::{ log_serialization_format::LogSerializationFormat, @@ -225,7 +225,7 @@ impl PipelineParts { let adjusting_mode = *Self::get_user_data(config, &ADJUSTING_MODE_KEY)?; let log = Self::get_user_data(old_context, &EVENT_LOG_KEY)?; - let mut new_context = PipelineContext::empty_from(old_context); + let mut new_context = PipelineContext::empty(); if adjusting_mode == AdjustingMode::FromUnattachedSubTraces { if let Ok(activities) = Self::get_user_data(old_context, &TRACE_ACTIVITIES_KEY) { @@ -243,9 +243,7 @@ impl PipelineParts { old_activities.push(new_activity.clone()); } - old_context - .pipeline_parts() - .unwrap() + PIPELINE_PARTS .create_add_unattached_events_part(config.clone()) .execute(old_context, infra)?; diff --git a/Ficus/src/rust/ficus/src/pipelines/context.rs b/Ficus/src/rust/ficus/src/pipelines/context.rs index 4decc5ca3..14d1d3640 100644 --- a/Ficus/src/rust/ficus/src/pipelines/context.rs +++ b/Ficus/src/rust/ficus/src/pipelines/context.rs @@ -1,17 +1,14 @@ -use crate::{ - pipelines::pipeline_parts::PipelineParts, - utils::{ - performance::performance_cookie::PerformanceLogger, - user_data::{ - keys::{DefaultKey, Key}, - user_data::{UserData, UserDataImpl}, - }, +use super::errors::pipeline_errors::PipelinePartExecutionError; +use crate::utils::{ + performance::performance_cookie::PerformanceLogger, + user_data::{ + keys::{DefaultKey, Key}, + user_data::{UserData, UserDataImpl}, }, }; +use getset::Getters; use std::{any::Any, sync::Arc}; -use super::errors::pipeline_errors::PipelinePartExecutionError; - pub trait LogMessageHandler: Send + Sync { fn handle(&self, message: &str) -> Result<(), PipelinePartExecutionError>; } @@ -41,29 +38,20 @@ impl PipelineInfrastructure { } } -#[derive(Clone, Default)] -pub struct PipelineContext<'a> { +#[derive(Clone, Getters)] +pub struct PipelineContext { user_data: UserDataImpl, - pipeline_parts: Option<&'a PipelineParts>, } -impl<'a> PipelineContext<'a> { - pub fn new_with_logging(parts: &'a PipelineParts) -> Self { - Self { - user_data: Default::default(), - pipeline_parts: Some(parts), - } - } - - pub fn empty_from(other: &'a PipelineContext) -> Self { +impl PipelineContext { + pub fn empty() -> Self { Self { user_data: Default::default(), - pipeline_parts: other.pipeline_parts, } } } -impl<'a> UserData for PipelineContext<'a> { +impl UserData for PipelineContext { fn len(&self) -> usize { self.user_data.len() } @@ -101,11 +89,7 @@ impl<'a> UserData for PipelineContext<'a> { } } -impl<'a> PipelineContext<'a> { - pub fn pipeline_parts(&self) -> Option<&PipelineParts> { - self.pipeline_parts - } - +impl PipelineContext { pub fn devastate_user_data(self) -> UserDataImpl { self.user_data } diff --git a/Ficus/src/rust/ficus/src/pipelines/errors/pipeline_errors.rs b/Ficus/src/rust/ficus/src/pipelines/errors/pipeline_errors.rs index 2f32a9190..dbcb3bfe5 100644 --- a/Ficus/src/rust/ficus/src/pipelines/errors/pipeline_errors.rs +++ b/Ficus/src/rust/ficus/src/pipelines/errors/pipeline_errors.rs @@ -1,7 +1,4 @@ -use std::{ - error::Error, - fmt::{Debug, Display, Formatter}, -}; +use std::fmt::{Debug, Display, Formatter}; #[derive(Debug)] pub enum PipelinePartExecutionError { @@ -28,6 +25,7 @@ impl PipelinePartExecutionError { } } +#[derive(Debug)] pub struct MissingContextError { context_key_name: String, } @@ -44,14 +42,7 @@ impl Display for MissingContextError { } } -impl Debug for MissingContextError { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.debug_struct("MissingContextError") - .field("context_key_name", &self.context_key_name) - .finish() - } -} - +#[derive(Debug)] pub struct RawPartExecutionError { message: String, } @@ -62,16 +53,6 @@ impl Display for RawPartExecutionError { } } -impl Debug for RawPartExecutionError { - fn fmt(&self, f: &mut Formatter<'_>) -> std::fmt::Result { - f.debug_struct("PipelinePartExecutionError") - .field("message", &self.message) - .finish() - } -} - -impl Error for RawPartExecutionError {} - impl RawPartExecutionError { pub fn new(message: String) -> Self { Self { message } diff --git a/Ficus/src/rust/ficus/src/pipelines/pipeline_parts.rs b/Ficus/src/rust/ficus/src/pipelines/pipeline_parts.rs index 40f199897..e7e1b3e0c 100644 --- a/Ficus/src/rust/ficus/src/pipelines/pipeline_parts.rs +++ b/Ficus/src/rust/ficus/src/pipelines/pipeline_parts.rs @@ -15,7 +15,7 @@ use crate::{ }; use derive_new::new; use fancy_regex::Regex; -use std::collections::HashMap; +use std::{cell::LazyCell, collections::HashMap}; pub struct PipelineParts { names_to_parts: HashMap, @@ -54,14 +54,10 @@ macro_rules! pipeline_part { }; } -impl Default for PipelineParts { - fn default() -> Self { - Self::new() - } -} +pub const PIPELINE_PARTS: LazyCell = LazyCell::new(|| PipelineParts::new()); impl PipelineParts { - pub fn new() -> Self { + fn new() -> Self { let parts = vec![ Self::read_log_from_xes(), Self::write_log_to_xes(), diff --git a/Ficus/src/rust/ficus/src/utils/xml_utils.rs b/Ficus/src/rust/ficus/src/utils/xml_utils.rs index eaf461f9b..b823ef60b 100644 --- a/Ficus/src/rust/ficus/src/utils/xml_utils.rs +++ b/Ficus/src/rust/ficus/src/utils/xml_utils.rs @@ -4,13 +4,13 @@ use quick_xml::{ }; use std::{ cell::RefCell, - error::Error, fmt::{Debug, Display}, io, string::FromUtf8Error, sync::Arc, }; +#[derive(Debug)] pub enum XmlWriteError { FromUt8Error(FromUtf8Error), IOError(io::Error), @@ -27,18 +27,6 @@ impl Display for XmlWriteError { } } -impl Debug for XmlWriteError { - fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { - match self { - Self::FromUt8Error(arg0) => f.debug_tuple("FromUt8Error").field(arg0).finish(), - Self::IOError(arg0) => f.debug_tuple("IOError").field(arg0).finish(), - Self::WriterError(arg0) => f.debug_tuple("WriterError").field(arg0).finish(), - } - } -} - -impl Error for XmlWriteError {} - pub fn write_empty(writer: &mut Writer, tag_name: &str, attrs: &Vec<(&str, &str)>) -> Result<(), XmlWriteError> where T: std::io::Write, diff --git a/Ficus/src/rust/ficus/tests/pipelines/pipeline_parts_tests.rs b/Ficus/src/rust/ficus/tests/pipelines/pipeline_parts_tests.rs index a1bf2bcc6..545fe9008 100644 --- a/Ficus/src/rust/ficus/tests/pipelines/pipeline_parts_tests.rs +++ b/Ficus/src/rust/ficus/tests/pipelines/pipeline_parts_tests.rs @@ -1,4 +1,4 @@ -use ficus::{pipelines::pipeline_parts::PipelineParts, vecs}; +use ficus::{pipelines::pipeline_parts::PIPELINE_PARTS, vecs}; fn get_test_parts_names() -> Vec { vecs![ @@ -97,18 +97,16 @@ fn get_test_parts_names() -> Vec { #[test] fn test_pipeline_parts() { - let parts = PipelineParts::new(); let names = get_test_parts_names(); for name in names { - assert!(parts.find_part(name.as_str()).is_some()); + assert!(PIPELINE_PARTS.find_part(name.as_str()).is_some()); } } #[test] fn test_pipeline_parts_count() { - let parts = PipelineParts::new(); let names = get_test_parts_names(); - assert_eq!(parts.len(), names.len()); + assert_eq!(PIPELINE_PARTS.len(), names.len()); } diff --git a/Ficus/src/rust/ficus_backend/src/grpc/backend_service.rs b/Ficus/src/rust/ficus_backend/src/grpc/backend_service.rs index befa2ab13..c8d2cb88c 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/backend_service.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/backend_service.rs @@ -9,7 +9,7 @@ use crate::{ }, grpc::{context_values_service::ContextValueService, pipeline_executor::ServicePipelineExecutionContext}, }; -use ficus::pipelines::pipeline_parts::PipelineParts; +use ficus::pipelines::pipeline_parts::PIPELINE_PARTS; use futures::Stream; use std::{pin::Pin, sync::Arc}; use tokio::sync::mpsc::{self, Sender}; @@ -21,15 +21,11 @@ pub(super) type GrpcSender = Sender, - pipeline_parts: Arc, } impl FicusService { pub fn new(cv_service: Arc) -> Self { - Self { - cv_service, - pipeline_parts: Arc::new(PipelineParts::new()), - } + Self { cv_service } } } @@ -41,7 +37,6 @@ impl GrpcBackendService for FicusService { &self, request: Request, ) -> Result, Status> { - let pipeline_parts = self.pipeline_parts.clone(); let (sender, receiver) = mpsc::channel(4); let context_values = match self.cv_service.reclaim_context_values(&request.get_ref().context_values_ids) { @@ -59,7 +54,7 @@ impl GrpcBackendService for FicusService { let sender = Arc::new(GrpcPipelineEventsHandler::new(sender)); let sender = sender as Arc; - let context = ServicePipelineExecutionContext::new(grpc_pipeline, &context_values, pipeline_parts, sender); + let context = ServicePipelineExecutionContext::new(grpc_pipeline, &context_values, sender); match context.execute_grpc_pipeline_and_fill_context_values(|_| Ok(()), cv_service) { Ok(uuid) => { @@ -85,8 +80,7 @@ impl GrpcBackendService for FicusService { async fn get_backend_info(&self, _: Request<()>) -> Result, Status> { Ok(Response::new(GrpcFicusBackendInfo { name: "RUST_FICUS_BACKEND".to_string(), - pipeline_parts: self - .pipeline_parts + pipeline_parts: PIPELINE_PARTS .pipeline_parts_descriptors() .into_iter() .map(|d| GrpcPipelinePartDescriptor { name: d.name() }) diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/grpc_kafka_service.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/grpc_kafka_service.rs index 138550ada..3e9577a13 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/grpc_kafka_service.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/grpc_kafka_service.rs @@ -18,9 +18,8 @@ use crate::{ }; use ficus::{ features::cases::CaseName, - pipelines::{ - keys::context_keys::{CASE_NAME_KEY, PIPELINE_ID_KEY, PIPELINE_NAME_KEY, PROCESS_NAME_KEY, SUBSCRIPTION_ID_KEY, SUBSCRIPTION_NAME_KEY}, - pipeline_parts::PipelineParts, + pipelines::keys::context_keys::{ + CASE_NAME_KEY, PIPELINE_ID_KEY, PIPELINE_NAME_KEY, PROCESS_NAME_KEY, SUBSCRIPTION_ID_KEY, SUBSCRIPTION_NAME_KEY, }, utils::user_data::user_data::UserData, }; @@ -34,16 +33,13 @@ use uuid::Uuid; pub struct GrpcKafkaServiceImpl { cv_service: Arc, kafka_service: Arc, - pipeline_parts: Arc, } impl GrpcKafkaServiceImpl { pub fn new(cv_service: Arc) -> Self { - let pipeline_parts = Arc::new(PipelineParts::default()); Self { cv_service: cv_service.clone(), - kafka_service: Arc::new(KafkaService::new(pipeline_parts.clone(), cv_service)), - pipeline_parts, + kafka_service: Arc::new(KafkaService::new(cv_service)), } } } @@ -213,7 +209,7 @@ impl GrpcKafkaService for GrpcKafkaServiceImpl { let handler = DelegatingEventsHandler::new(vec![kafka_handler, grpc_handler]); let handler = Arc::new(handler) as Arc; - let dto = PipelineExecutionDto::new(self.pipeline_parts.clone(), handler); + let dto = PipelineExecutionDto::new(handler); let context_values = match self .cv_service diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs index f1beb9561..d96a46940 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/kafka_service.rs @@ -90,16 +90,14 @@ impl KafkaSubscription { } pub struct KafkaService { - pipeline_parts: Arc, subscriptions_to_execution_requests: Arc>>, cv_service: Arc, logger: ConsoleLogMessageHandler, } impl KafkaService { - pub fn new(pipeline_parts: Arc, cv_service: Arc) -> Self { + pub fn new(cv_service: Arc) -> Self { Self { - pipeline_parts, subscriptions_to_execution_requests: Arc::new(Mutex::new(HashMap::new())), logger: ConsoleLogMessageHandler::new(), cv_service, @@ -228,10 +226,7 @@ impl KafkaService { continue; }; - let execution_dto = PipelineExecutionDto::new( - Arc::new(PipelineParts::new()), - Arc::new(EmptyPipelineEventsHandler::new()) as Arc, - ); + let execution_dto = PipelineExecutionDto::new(Arc::new(EmptyPipelineEventsHandler::new()) as Arc); let trace_processing_context = KafkaTraceProcessingContext { execution_dto, trace }; @@ -284,7 +279,7 @@ impl KafkaService { }; let handler = handler as Arc; - let execution_dto = PipelineExecutionDto::new(Arc::new(PipelineParts::new()), handler); + let execution_dto = PipelineExecutionDto::new(handler); let context = Self::create_pipeline_execution_context(&pipeline.request, &execution_dto); let result = context.execute_grpc_pipeline_and_fill_context_values( @@ -341,7 +336,7 @@ impl KafkaService { streaming_config: StreamingConfiguration, ) -> KafkaSubscriptionPipeline { let handler = Arc::new(handler) as Arc; - let dto = PipelineExecutionDto::new(self.pipeline_parts.clone(), handler); + let dto = PipelineExecutionDto::new(handler); KafkaSubscriptionPipeline::new(request, dto, pipeline_name, streaming_config.create_processor()) } @@ -375,7 +370,7 @@ impl KafkaService { context_values: &'a Vec, dto: &PipelineExecutionDto, ) -> ServicePipelineExecutionContext<'a> { - ServicePipelineExecutionContext::new(pipeline, context_values, dto.pipeline_parts.clone(), dto.events_handler.clone()) + ServicePipelineExecutionContext::new(pipeline, context_values, dto.events_handler.clone()) } fn create_pipeline_execution_context<'a>( @@ -384,12 +379,7 @@ impl KafkaService { ) -> ServicePipelineExecutionContext<'a> { let grpc_pipeline = pipeline_req.pipeline.as_ref().expect("Pipeline should be supplied"); - ServicePipelineExecutionContext::new( - grpc_pipeline, - &pipeline_req.initial_context, - dto.pipeline_parts.clone(), - dto.events_handler.clone(), - ) + ServicePipelineExecutionContext::new(grpc_pipeline, &pipeline_req.initial_context, dto.events_handler.clone()) } pub(super) fn create_kafka_events_handler(producer_metadata: Option<&GrpcKafkaConnectionMetadata>) -> Result { diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs index 865876d9a..6755fc5dd 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/models.rs @@ -9,7 +9,6 @@ use ficus::{ context::PipelineContext, errors::pipeline_errors::PipelinePartExecutionError, keys::context_keys::{CASE_NAME_KEY, PROCESS_NAME_KEY, UNSTRUCTURED_METADATA_KEY}, - pipeline_parts::PipelineParts, }, utils::user_data::user_data::UserData, }; @@ -69,16 +68,12 @@ impl Display for XesFromBxesKafkaTraceCreatingError { #[derive(Clone)] pub struct PipelineExecutionDto { - pub(super) pipeline_parts: Arc, pub(super) events_handler: Arc, } impl PipelineExecutionDto { - pub fn new(pipeline_parts: Arc, events_handler: Arc) -> Self { - Self { - pipeline_parts, - events_handler, - } + pub fn new(events_handler: Arc) -> Self { + Self { events_handler } } } diff --git a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/processors.rs b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/processors.rs index 78f405f60..735f1078a 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/processors.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/kafka/streaming/t2/processors.rs @@ -55,7 +55,8 @@ impl T2StreamingProcessor { }; let xes_trace = if let Some(preprocessing_pipeline) = self.trace_preprocessing_pipeline.as_ref() { - let mut preprocessing_context = PipelineContext::default(); + let mut preprocessing_context = PipelineContext::empty(); + let mut log = XesEventLogImpl::default(); log.push(Rc::new(RefCell::new(xes_trace))); @@ -65,7 +66,6 @@ impl T2StreamingProcessor { let preprocessing_pipeline = ServicePipelineExecutionContext::new( preprocessing_pipeline, &initial_context_values, - context.execution_dto.pipeline_parts.clone(), context.execution_dto.events_handler.clone(), ); diff --git a/Ficus/src/rust/ficus_backend/src/grpc/pipeline_executor.rs b/Ficus/src/rust/ficus_backend/src/grpc/pipeline_executor.rs index 247eec2b7..ea2528025 100644 --- a/Ficus/src/rust/ficus_backend/src/grpc/pipeline_executor.rs +++ b/Ficus/src/rust/ficus_backend/src/grpc/pipeline_executor.rs @@ -13,7 +13,7 @@ use ficus::{ context::{LogMessageHandler, PipelineContext, PipelineInfrastructure}, errors::pipeline_errors::PipelinePartExecutionError, keys::context_keys::{EXECUTION_ID_KEY, find_context_key}, - pipeline_parts::PipelineParts, + pipeline_parts::PIPELINE_PARTS, pipelines::{DefaultPipelinePart, Pipeline, PipelinePart}, }, utils::{ @@ -27,7 +27,6 @@ use uuid::Uuid; pub(super) struct ServicePipelineExecutionContext<'a> { grpc_pipeline: &'a GrpcPipeline, context_values: &'a Vec, - pipeline_parts: Arc, handler: Arc, log_message_handler: Arc, } @@ -36,7 +35,6 @@ impl<'a> ServicePipelineExecutionContext<'a> { pub fn new( grpc_pipeline: &'a GrpcPipeline, context_values: &'a Vec, - pipeline_parts: Arc, handler: Arc, ) -> Self { let log_message_handler = Self::create_log_message_handler(handler.clone()); @@ -44,7 +42,6 @@ impl<'a> ServicePipelineExecutionContext<'a> { Self { grpc_pipeline, context_values, - pipeline_parts, handler, log_message_handler, } @@ -70,10 +67,6 @@ impl<'a> ServicePipelineExecutionContext<'a> { self.grpc_pipeline } - pub fn parts(&self) -> &PipelineParts { - &self.pipeline_parts - } - pub fn context_values(&self) -> &Vec { self.context_values } @@ -86,7 +79,6 @@ impl<'a> ServicePipelineExecutionContext<'a> { Self { grpc_pipeline: new_grpc_pipeline, context_values: self.context_values, - pipeline_parts: self.pipeline_parts.clone(), handler: self.handler.clone(), log_message_handler: self.log_message_handler.clone(), } @@ -211,14 +203,13 @@ impl<'a> ServicePipelineExecutionContext<'a> { } } - self - .parts() + PIPELINE_PARTS .find_part(&grpc_default_part.name) .map(|default_part| Box::new(default_part(Box::new(part_config)))) } - pub(super) fn create_initial_context(&'a self) -> PipelineContext<'a> { - let mut pipeline_context = PipelineContext::new_with_logging(self.parts()); + pub(super) fn create_initial_context(&'a self) -> PipelineContext { + let mut pipeline_context = PipelineContext::empty(); for value in self.context_values() { let key = find_context_key(&value.key.as_ref().unwrap().name).unwrap(); diff --git a/scripts/windows/generate_grpc_models.ps1 b/scripts/windows/generate_grpc_models.ps1 new file mode 100644 index 000000000..04f0c6d6e --- /dev/null +++ b/scripts/windows/generate_grpc_models.ps1 @@ -0,0 +1,18 @@ +$ErrorActionPreference = "Stop" + +Push-Location "$PSScriptRoot/../../Ficus/src/python/infra" +python generate_models.py ficus.grpc_pipelines ../ficus/grpc_pipelines/ ../../../protos +Pop-Location + +$env:GOPATH = "$HOME/go" +$env:PATH = "$env:PATH;$env:GOPATH/bin" + +Push-Location "$PSScriptRoot/../../Ficus/src/go/grpcmodels" +protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative --proto_path=../../../protos/ ../../../protos/*.proto +Pop-Location + +Push-Location "$PSScriptRoot/../../Ficus/src/front/FicusFrontend/FicusDashboard/Npm" +Get-ChildItem "../../../../../protos/*.proto" | ForEach-Object { + & .\node_modules\.bin\proto-loader-gen-types.ps1 --longs=Number --enums=number --defaults --oneofs --grpcLib=@grpc/grpc-js --outDir=./src/protos/ "../../../../../protos/$($_.Name)" --inputTemplate "%s_DONTUSE" --outputTemplate "%s" +} +Pop-Location \ No newline at end of file