Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflow hashes are not consistent when blocks are the same but mixed #121

Open
1 of 2 tasks
GhislainJ opened this issue Nov 17, 2021 · 1 comment
Open
1 of 2 tasks
Assignees
Labels
Priority: Medium Issue has a good dev/value ratio Status: Stand by Issue or PR is not evolving Type: Bug Something isn't working
Milestone

Comments

@GhislainJ
Copy link
Collaborator

**Note: for support questions, please use https://nextcloud.dessia.tech/call/hr9z9bif

  • I'm submitting a ...

    • bug report
    • feature request
  • What is the current behavior?

Workflow hash computes differently when its blocks sequence is "shuffled"

  • If the current behavior is a bug, please provide the steps to reproduce and if possible a minimal demo of the problem Avoid reference to other packages

Build twice the exact same workflow by only changing order of blocks. Compute hash, results are different.

Steps to reproduce :

from dessia_common.workflow import Workflow, InstantiateModel, ModelMethod, Pipe
from dessia_common.forms import Generator
from dessia_common.typings import MethodType

instantiate_block = InstantiateModel(model_class=Generator, name="Generator")

method_type = MethodType(class_=Generator, name="generate")
generate_block = ModelMethod(method_type=method_type)

pipes = [Pipe(instantiate_block.outputs[0], generate_block.inputs[0])]
output = generate_block.outputs[0]

blocks1 = [instantiate_block, generate_block]
workflow1 = Workflow(blocks=blocks1, pipes=pipes, output=output)

blocks2 = [generate_block, instantiate_block]
workflow2 = Workflow(blocks=blocks2, pipes=pipes, output=output)

print("Hash Workflow1 :", hash(workflow1))
print("Hash Workflow2 :", hash(workflow2))

Result :

Hash Workflow1 : 89
Hash Workflow2 : 88
  • What is the expected behavior?

Such workflows should be considered equal

  • What is the motivation / use case for changing the behavior?

Frontend's workflow builder will really be subject to it, as someone would add blocks not in any particular order.

  • Possible fixes
    This looks like it comes from the ouput hash. We sum its variable_indices elements which are bound to block index.
    Should we add a hash computation for Variables ?

  • Please tell us about your environment:

    • branch: dev/master
    • commit:
    • python version: python3.9
@GhislainJ GhislainJ added the Type: Bug Something isn't working label Nov 17, 2021
@GhislainJ GhislainJ added this to the v0.4.8 milestone Nov 17, 2021
@GhislainJ GhislainJ self-assigned this Nov 17, 2021
@GhislainJ
Copy link
Collaborator Author

Actually, we should use graphs for eq/hash, instead of evaluating hash for Variables as proposed

@GhislainJ GhislainJ modified the milestones: v0.6.0, Fixes Mar 1, 2022
@GhislainJ GhislainJ added the Priority: High Issue has a high dev/value ratio label Nov 10, 2022
@GhislainJ GhislainJ added Priority: Medium Issue has a good dev/value ratio Status: Stand by Issue or PR is not evolving and removed Priority: High Issue has a high dev/value ratio labels Feb 22, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Priority: Medium Issue has a good dev/value ratio Status: Stand by Issue or PR is not evolving Type: Bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant