Skip to content

Visualization misrepresents Collect[...] nodes #556

Description

@elijahbenizzy

With multiple collect inputs it displays multiple crow-feet. This happens because we don't konw which ones are in which groups.

  1. Simplest solution -- don't fix for now
  2. Next-simplest -- tag/mark these when traversing as being parts of groups, we can handle later in viz
  3. Most complex -- move visualize_execution out to the executor, which can handle this (basically render the metadata in (2)
from hamilton import driver, ad_hoc_utils
from hamilton.htypes import Parallelizable, Collect

def not_to_repeat() -> int:
    return -1


def number_to_repeat(iterations: int) -> Parallelizable[int]:
    for i in range(iterations):
        yield i


def something_else_not_to_repeat() -> int:
    return -2


def double(number_to_repeat: int) -> int:
    return number_to_repeat * 2


def summed(double: Collect[int], not_to_repeat: int, something_else_not_to_repeat: int) -> int:
    return sum(double) + not_to_repeat + something_else_not_to_repeat

mod = ad_hoc_utils.create_temporary_module(not_to_repeat, number_to_repeat, something_else_not_to_repeat, double, summed)

dr = (driver.Builder()
    .with_modules(mod)
    .enable_dynamic_execution(allow_experimental_mode=True)
    .build()
)
dr.visualize_execution(["summed"], "./out", inputs={"iterations": 100}, render_kwargs={"format" : "png"})

image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriagelabel for issues that need to be triaged.visualization

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions