Skip to content

Conversation

@samwaseda
Copy link
Member

@samwaseda samwaseda commented Dec 31, 2025

In the previous algorithm, the hash of only one single node could be hashed. With the new one, the full workflow can be hashed. Also the algorithm itself is more efficient.

from flowrep import workflow as fwf

def add(x: float = 2.0, y: float = 1) -> float:
    return x + y


def multiply(x: float, y: float = 5) -> float:
    return x * y

@fwf.workflow
def workflow_with_data(a=10, b=20):
    x = add(a, b)
    y = multiply(x, b)
    return x, y

workflow_dict = workflow_with_data.run()
hashed_dict = fwf.get_hashed_node_dict(workflow_dict)

print(hashed_dict)

Output:

{
    "workflow_with_data-add_0": {
        "inputs": {
            "x": 10,
            "y": 20
        },
        "outputs": [
            "output"
        ],
        "node": {
            "module": "__main__",
            "qualname": "add",
            "version": "not_defined",
            "connected_inputs": []
        },
        "hash": "4900f81b21790ab02c7187e991921fca30dc4c050dcd12d3428eb6490c600dec"
    },
    "workflow_with_data-multiply_0": {
        "inputs": {
            "y": 20,
            "x": "4900f81b21790ab02c7187e991921fca30dc4c050dcd12d3428eb6490c600dec@output"
        },
        "outputs": [
            "output"
        ],
        "node": {
            "module": "__main__",
            "qualname": "multiply",
            "version": "not_defined",
            "connected_inputs": [
                "x"
            ]
        },
        "hash": "cab7d00b6dc0d19170a8cbc35df1b2ffb559f3521b890a0323b200b84f614faa"
    }
}

@github-actions
Copy link

Binder 👈 Launch a binder notebook on branch pyiron/flowrep/graph

@codecov
Copy link

codecov bot commented Dec 31, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 96.05%. Comparing base (e07d379) to head (79aad77).
⚠️ Report is 6 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main      #61      +/-   ##
==========================================
- Coverage   96.97%   96.05%   -0.93%     
==========================================
  Files           3        3              
  Lines         629      659      +30     
==========================================
+ Hits          610      633      +23     
- Misses         19       26       +7     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@samwaseda samwaseda merged commit f788b97 into main Dec 31, 2025
18 of 19 checks passed
@samwaseda samwaseda deleted the graph branch December 31, 2025 01:00
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