Skip to content

ForNodes don't seem to cache output and have inverse iteration order #610

@pmrv

Description

@pmrv

I noticed that in the MWE below, the prints in the for node trigger on every pull, but in the range node only once (as intended). Also the for loop prints the list from the last item backwards. Afaict, this is not specified and by piping the input through the node output is not ambiguous, but it's a bit non-intuitive.

@Workflow.wrap.as_function_node('y')
def Double(x: int) -> int:
    print(x)
    return x*2

@Workflow.wrap.as_function_node('range')
def Range(max: int) -> list[int]:
    print('MAX', max)
    return list(range(max))

dl = Double.for_node(iter_on='x', output_as_dataframe=False)

r = Range(4)

dl.inputs.x = r.outputs.range

dl.pull()

dl.pull()

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions