Skip to content

Let nodes run on instantiation #42

@liamhuber

Description

@liamhuber

From #38

We won't abandon delayed execution, but let's add a flag to allow newly instantiated nodes to run (if ready), ala

from pyiron_workflow import Workflow

@Workflow.wrap_as.function_node(run_on_instantiation=True)
def update_immediately(x=0, y=1):
    return x+1, y+2

default_aggressive = update_immediately(y=3)
print(default_aggressive.outputs.to_value_dict())
>>> {"x+1": 1, "y+2": 5}

# Or
@Workflow.wrap_as.function_node()
def normal(x=0, y=1):
    return x-1, y-2

explicit_instruction_to_be_agressive = normal(x=10, run_on_instantiation=True)
print(explicit_instruction_to_be_agressive.outputs.to_value_dict())
>>> {"x-1": 9, "y-2": -1}

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