Skip to content

Conversation

@SimonHeybrock
Copy link
Member

@SimonHeybrock SimonHeybrock commented Jan 13, 2026

Summary

  • Add StreamProcessor.visualize() method that post-processes sciline's visualization to highlight streaming-specific node classifications
  • Node categories shown: static (gray), dynamic keys/nodes (green), context keys/dependent (blue), accumulators (orange cylinder), finalize nodes (plum), targets (double border)
  • Include optional legend explaining the color scheme

Examples

Default (fall graph):

image

With show_static_dependencies=False:
image

Add visualization support that displays the workflow graph with node
classification styling to help understand the streaming data flow:

- Static nodes (gray): Pre-computed once, cached
- Context keys/nodes (blue): Input entry points and cached dependents
- Dynamic keys/nodes (green): Chunk inputs and per-chunk computations
- Accumulator keys (orange cylinder): Aggregation points
- Finalize nodes (lavender): Computed from accumulators
- Target keys (double border): Final outputs

The method stores the base workflow during __init__ to show the full
graph including pre-computed static subgraphs. Dynamic and context
keys are styled with black borders to override sciline's red "unsatisfied"
styling since these are intentional stream inputs.

---

Prompt: develop an understanding of StreamProcessor, then think about how
we can make an equivalent to sciline.Pipeline.visualize, highlight specifics
of the wrapping StreamProcessor - where are accumulators, which are dynamic
inputs, which nodes are cached and which are downstream of dynamic and thus
recomputed?
@SimonHeybrock SimonHeybrock changed the title Add StreamProcessor.visualize() method with tests Add StreamProcessor.visualize() method Jan 13, 2026
- Unify _find_descendants and _find_graph_descendants into a single
  function that accepts either Pipeline or DiGraph
- Convert _classify_nodes_for_visualization to a method _classify_nodes
  on StreamProcessor for cleaner access to instance attributes
- Add comprehensive tests for visualization in streaming_visualize_test.py

Prompt: Please carefully think through and review the implementation of
StreamProcessor.visualize. Could it be written in a better way, e.g., by
relying more on what StreamProcessor already does in __init__ (node
classification, ...)?

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@SimonHeybrock SimonHeybrock force-pushed the add-stream-processor-visualize branch from 23a5dc1 to 5ea0769 Compare January 13, 2026 12:48
SimonHeybrock and others added 3 commits January 14, 2026 09:43
- Exclude nodes unreachable from target_keys (unrelated branches)
- Show full static subgraph including nodes upstream of input keys
- Build visualization workflow once in constructor for consistency
- Classify nodes based on actual visualized graph to ensure all
  visible nodes are properly styled

Prompt: StreamProcessor.visualize currently seems to show the full graph,
even parts/nodes unreachable/unused by computing the given targets.
Also fixes: visualization shows nodes upstream of input keys (dynamic_keys,
context_keys). Also fixes: some root nodes appearing unstyled/white.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
…alize color

- Distinguish between static nodes (dependencies) and actually cached nodes
  by adding thick border to cached nodes in visualization
- Change finalize nodes color from lavender (#E6E6FA) to plum (#DDA0DD)
  for better distinction from Sciline's cluster grouping color
- Add cached_keys classification to track nodes at the dynamic boundary
- Update legend to show both "Static" and "Static (cached)" entries
- Add tests for cached_keys classification and styling

Prompt: Consider changes w.r.t. `main`. There are two small things to fix/improve
in `visualize`:
1. Currently all precomputed nodes are labelled as "Static (cached)", even
   those that are just dependencies of cached nodes. We do want to show these
   nodes but the label is misleading. I am not sure if we should color them
   differently, or add a frame for the actual cached nodes?
2. The color for the part of the graph running after "finalize" is not
   clear/obvious enough. It is also too similar to the color Sciline uses
   for grouping generic nodes.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
Add parameter to hide ancestors of cached nodes for a simplified graph view.
When show_static_dependencies=False, the visualization prunes the static
dependency chain and only shows cached nodes at the boundary.

The legend is also updated to conditionally show the "Static" entry only
when static dependencies are displayed.

Prompt: Can you add an option to not display the static (not cached) parts
of the graph?

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
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.

2 participants