rwth-i6 / sisyphus

A Workflow Manager in Python
Mozilla Public License 2.0
45 stars 24 forks source link

`sis_hash_helper` on `enum.Enum`s is Python version dependent #188

Closed albertz closed 5 months ago

albertz commented 5 months ago

The use of enum.Enum currently results in different Sisyphus hashes depending on the Python version…

E.g. from i6_core, we have:

class MergeStrategy(enum.Enum):
    SUBCORPORA = 0
    FLAT = 1
    CONCATENATE = 2

sis_hash_helper(MergeStrategy.FLAT) gives:

I think most people still use Python <=3.10? Am i the only one using a more recent Python? I would suggest a fix on Sisyphus side to always keep the old python <=3.10 hash of enum, even on newer Python versions. That will require a special check for enum, but I think that’s ok.

michelwi commented 5 months ago

Am i the only one using a more recent Python?

It seems so.

suggest a fix on Sisyphus side to always keep the old python <=3.10 hash of enum

yes, agreed.

critias commented 5 months ago

I didn't expect the enum state to blow up like that. There would also be the option to encode it into something shorter, e.g. b'(Enum, i6_core.corpus.transform. MergeStrategy.Flat)', but that would now change the hash. Keeping the old behavior looks reasonable to me.