Skip to content
Open
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
1 change: 1 addition & 0 deletions All.sln
Original file line number Diff line number Diff line change
Expand Up @@ -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}"
Expand Down
2 changes: 1 addition & 1 deletion Ficus/docker/run/Run.RustFicusBackend.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion Ficus/docker/tests/Tests.Rust.Dockerfile
Original file line number Diff line number Diff line change
@@ -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
Expand Down
6 changes: 5 additions & 1 deletion Ficus/src/python/infra/generate_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = []

Expand Down
13 changes: 2 additions & 11 deletions Ficus/src/rust/ficus/src/event_log/xes/xes_event.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<HashMap<Arc<str>, 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<str>, timestamp: DateTime<Utc>, payload: Option<HashMap<Arc<str>, EventPayloadValue>>) -> Self {
Self {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ use getset::{Getters, MutGetters};
use std::{
cell::RefCell,
collections::HashMap,
error::Error,
fmt::{Debug, Display, Formatter},
ops::Deref,
rc::Rc,
Expand Down Expand Up @@ -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 {
Expand All @@ -92,8 +86,6 @@ impl Display for LogThreadsDiagramError {
}
}

impl Error for LogThreadsDiagramError {}

impl From<LogThreadsDiagramError> for PipelinePartExecutionError {
fn from(val: LogThreadsDiagramError) -> Self {
PipelinePartExecutionError::Raw(RawPartExecutionError::new(val.to_string()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ use crate::{
};
use std::{
cell::RefCell,
error::Error,
fmt::{Debug, Display, Formatter},
rc::Rc,
str::FromStr,
Expand All @@ -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
Expand Down
8 changes: 3 additions & 5 deletions Ficus/src/rust/ficus/src/pipelines/activities_parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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) {
Expand All @@ -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)?;

Expand Down
42 changes: 13 additions & 29 deletions Ficus/src/rust/ficus/src/pipelines/context.rs
Original file line number Diff line number Diff line change
@@ -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>;
}
Expand Down Expand Up @@ -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()
}
Expand Down Expand Up @@ -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
}
Expand Down
25 changes: 3 additions & 22 deletions Ficus/src/rust/ficus/src/pipelines/errors/pipeline_errors.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,4 @@
use std::{
error::Error,
fmt::{Debug, Display, Formatter},
};
use std::fmt::{Debug, Display, Formatter};

#[derive(Debug)]
pub enum PipelinePartExecutionError {
Expand All @@ -28,6 +25,7 @@ impl PipelinePartExecutionError {
}
}

#[derive(Debug)]
pub struct MissingContextError {
context_key_name: String,
}
Expand All @@ -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,
}
Expand All @@ -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 }
Expand Down
10 changes: 3 additions & 7 deletions Ficus/src/rust/ficus/src/pipelines/pipeline_parts.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<String, PipelinePartFactory>,
Expand Down Expand Up @@ -54,14 +54,10 @@ macro_rules! pipeline_part {
};
}

impl Default for PipelineParts {
fn default() -> Self {
Self::new()
}
}
pub const PIPELINE_PARTS: LazyCell<PipelineParts> = 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(),
Expand Down
14 changes: 1 addition & 13 deletions Ficus/src/rust/ficus/src/utils/xml_utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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),
Expand All @@ -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<T>(writer: &mut Writer<T>, tag_name: &str, attrs: &Vec<(&str, &str)>) -> Result<(), XmlWriteError>
where
T: std::io::Write,
Expand Down
8 changes: 3 additions & 5 deletions Ficus/src/rust/ficus/tests/pipelines/pipeline_parts_tests.rs
Original file line number Diff line number Diff line change
@@ -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<String> {
vecs![
Expand Down Expand Up @@ -97,18 +97,16 @@ fn get_test_parts_names() -> Vec<String> {

#[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());
}
Loading
Loading