Skip to content

Commit 54dcd8b

Browse files
committed
Add BPMN DI layout generation at the end of the Simod run. Closes #154
The current problem was that (a) SplitMiner CLI tool didn't generate BPMN DI part of the BPMN; (b) during the extraneous timers discovery new elements are added to the control flow, so a new layout generation has been required. This commit adds a Java dependency to run on a BPMN file with the control flow to add the generated diagram in the XML format.
1 parent 396279f commit 54dcd8b

File tree

5 files changed

+22
-3
lines changed

5 files changed

+22
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ build-backend = "poetry.core.masonry.api"
44

55
[tool.poetry]
66
name = "simod"
7-
version = "4.0.3"
7+
version = "4.1.0"
88
authors = [
99
"Ihar Suvorau <ihar.suvorau@gmail.com>",
1010
"David Chapela <david.chapela@ut.ee>",

src/simod/control_flow/discovery.py

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,8 @@
99
)
1010
from simod.utilities import execute_external_command, is_windows
1111

12-
split_miner_jar_path: Path = Path(__file__).parent / "lib/splitminer-1.6-all.jar"
12+
split_miner_jar_path: Path = Path(__file__).parent / "lib/split-miner-1.7.1-all.jar"
13+
bpmn_layout_jar_path: Path = Path(__file__).parent / "lib/bpmn-layout-1.0.6-jar-with-dependencies.jar"
1314

1415

1516
def discover_process_model(log_path: Path, output_model_path: Path, params: HyperoptIterationParams):
@@ -40,6 +41,21 @@ def discover_process_model(log_path: Path, output_model_path: Path, params: Hype
4041
assert output_model_path.exists(), f"Error trying to discover the process model in '{output_model_path}'."
4142

4243

44+
def add_bpmn_diagram_to_model(bpmn_model_path: Path):
45+
"""
46+
Add BPMN diagram to the control flow of the existing BPMN model using the hierarchical layout algorithm.
47+
This function overwrites the existing BPMN model file.
48+
49+
:param bpmn_model_path:
50+
:return: None
51+
"""
52+
global bpmn_layout_jar_path
53+
54+
args = ["java", "-jar", str(bpmn_layout_jar_path), str(bpmn_model_path)]
55+
print_step(f"Adding BPMN diagram to the model: {args}")
56+
execute_external_command(args)
57+
58+
4359
@dataclass
4460
class SplitMinerV1Settings:
4561
log_path: Path
Binary file not shown.
48.7 MB
Binary file not shown.

src/simod/simod.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
from simod.batching.discovery import discover_batching_rules
1818
from simod.case_attributes.discovery import discover_case_attributes
1919
from simod.cli_formatter import print_section, print_subsection
20-
from simod.control_flow.discovery import discover_process_model
20+
from simod.control_flow.discovery import discover_process_model, add_bpmn_diagram_to_model
2121
from simod.control_flow.optimizer import ControlFlowOptimizer
2222
from simod.control_flow.settings import HyperoptIterationParams as ControlFlowHyperoptIterationParams
2323
from simod.event_log.event_log import EventLog
@@ -238,6 +238,9 @@ def run(self):
238238
self._clean_up()
239239
self._settings.to_yaml(self._best_result_dir)
240240

241+
# --- Add BPMN diagram to the model --- #
242+
add_bpmn_diagram_to_model(self.final_bps_model.process_model)
243+
241244
def _optimize_control_flow(self) -> ControlFlowHyperoptIterationParams:
242245
"""
243246
Control-flow and Gateway Probabilities discovery.

0 commit comments

Comments
 (0)