Feature/small refactor #109
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This pull request refactors the flow graph visualization and utility logic by moving and modernizing the graph tree code. The main changes involve relocating graph-related functions from
util/graph_tree.py
to a new, more structured modulegraph_tree/graph_tree.py
, introducing Pydantic models for better type safety, and updating the main flow graph code to use the new structure and interfaces. There are also minor improvements to logging and code clarity.Refactor and modularization of graph tree utilities:
calculate_depth
,build_node_info
,draw_merged_paths
, etc.) have been moved fromflowfile_core/flowfile_core/flowfile/util/graph_tree.py
to a new moduleflowfile_core/flowfile_core/flowfile/graph_tree/graph_tree.py
, and the old file has been deleted. This improves code organization and maintainability. [1] [2]InputInfo
,BranchInfo
) for node information, improving type safety and code clarity. These models are defined in a new fileflowfile_core/flowfile_core/flowfile/graph_tree/models.py
. [1] [2]Updates to flow graph implementation:
flow_graph.py
file is updated to import from the newgraph_tree
module and to use the new Pydantic-based data structures and function signatures. This includes renaming functions (e.g.,add_undrawn_nodes
→add_un_drawn_nodes
) and updating attribute access to match the new models. [1] [2] [3]print_tree
: empty graphs now log viaflow_logger.info
instead of printing directly, and some code is streamlined for clarity. [1] [2]Cleanup:
flow_graph.py
to keep the codebase clean. [1] [2]These changes collectively improve the maintainability, readability, and robustness of the flow graph visualization and underlying graph logic.