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

[BUG] Lift restrictions on the definition of HashMethod #2912

Closed
2 tasks done
eapolinario opened this issue Sep 23, 2022 · 0 comments
Closed
2 tasks done

[BUG] Lift restrictions on the definition of HashMethod #2912

eapolinario opened this issue Sep 23, 2022 · 0 comments
Assignees
Labels
bug Something isn't working
Milestone

Comments

@eapolinario
Copy link
Contributor

Describe the bug

Currently we only allow for the hash of pandas dataframes and StructuredDatasets to be overridden, but we found out that users are interested in overriding the hash of any value, including primitive types.

Expected behavior

We should lift the restriction on the definition of HashMethod and let any value have its hash overridden.

Additional context to reproduce

Note the use of a constant hash function in the definition of t0. This implies that consecutive executions of the following workflow should hit the cache (notice the use of an integer, which is a primitive type):

def constant_hash_function(a: int) -> str:
    return "hash"

@task
def t0(a: int) -> Annotated[int, HashMethod(function=constant_hash_function)]:
    return a

@task(cache=True, cache_version="0.0.1")
def t1(cached_a: int) -> int:
    return cached_a

@workflow
def wf(a: int) -> int:
    annotated_a = t0(a=a)
    return t1(cached_a=annotated_a)

Screenshots

No response

Are you sure this issue hasn't been raised already?

  • Yes

Have you read the Code of Conduct?

  • Yes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

1 participant