Skip to content

Another issue with graph analysis and conditional branches #23

Description

@poautran

In GitLab by @woutdenolf on Nov 12, 2025, 14:07 GMT+1:

from ewoks import execute_graph

def run(a=None, b=None):
    print(f"{a=}, {b=}")
    return {"a":(a or 0) + 1, "b":(b or 0) + 1}

def endrun(a=None, b=None):
    print(f"END {a=}, {b=}")
    return {"a":(a or 0) + 1, "b":(b or 0) + 1}

workflows = {
    "graph": {},
    "nodes": [
        {"id": "start0", "task_type": "ppfmethod", "task_identifier": "__main__.run"},
        {"id": "start", "task_type": "ppfmethod", "task_identifier": "__main__.run"},
        {"id": "up", "task_type": "ppfmethod", "task_identifier": "__main__.run"},
        {"id": "down", "task_type": "ppfmethod", "task_identifier": "__main__.run"},
        {"id": "end", "task_type": "ppfmethod", "task_identifier": "__main__.endrun"},
    ],
    "links": [
        {"source": "start0", "target": "start", "map_all_data":True, "conditions": [{"source_output": "a", "value": 1}]},
        {"source": "start", "target": "up", "map_all_data":True},
        {"source": "start", "target": "down", "map_all_data":True},
        {"source": "up", "target": "end", "map_all_data":True},
        {"source": "down", "target": "end", "map_all_data":True}
    ]
}

import logging
# logging.basicConfig(level=logging.DEBUG)
result = execute_graph(workflows, engine="ppf")

The end node is triggered twice which should not be the case

a=None, b=None
a=1, b=1
a=2, b=2
END a=3, b=3
a=2, b=2
END a=3, b=3

Migrated from GitLab: https://gitlab.esrf.fr/workflow/ewoks/ewoksppf/-/issues/23

Metadata

Metadata

Assignees

No one assigned

    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