Skip to content

Conversation

Edwardvaneechoud
Copy link
Owner

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 module graph_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:

  • All functions related to graph tree construction and visualization (such as calculate_depth, build_node_info, draw_merged_paths, etc.) have been moved from flowfile_core/flowfile_core/flowfile/util/graph_tree.py to a new module flowfile_core/flowfile_core/flowfile/graph_tree/graph_tree.py, and the old file has been deleted. This improves code organization and maintainability. [1] [2]
  • The new graph tree module now uses Pydantic models (InputInfo, BranchInfo) for node information, improving type safety and code clarity. These models are defined in a new file flowfile_core/flowfile_core/flowfile/graph_tree/models.py. [1] [2]

Updates to flow graph implementation:

  • The flow_graph.py file is updated to import from the new graph_tree module and to use the new Pydantic-based data structures and function signatures. This includes renaming functions (e.g., add_undrawn_nodesadd_un_drawn_nodes) and updating attribute access to match the new models. [1] [2] [3]
  • Minor improvements in print_tree: empty graphs now log via flow_logger.info instead of printing directly, and some code is streamlined for clarity. [1] [2]

Cleanup:

  • Unused imports have been removed from 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.

@Edwardvaneechoud Edwardvaneechoud marked this pull request as ready for review August 23, 2025 09:28
@Edwardvaneechoud Edwardvaneechoud merged commit 0af2f5e into main Aug 23, 2025
12 checks passed
@Edwardvaneechoud Edwardvaneechoud deleted the feature/small_refactor branch August 23, 2025 09:31
Bennylave pushed a commit to Bennylave/Flowfile that referenced this pull request Aug 26, 2025
* Adding test file for print_tree

* Small refactor that adds types to functions
Bennylave pushed a commit to Bennylave/Flowfile that referenced this pull request Aug 26, 2025
* Adding test file for print_tree

* Small refactor that adds types to functions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant