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

Handles partials in source code hash #1116

Merged
merged 4 commits into from
Sep 4, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion hamilton/lifecycle/default.py
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,10 @@ def run_to_execute_node(
if node_name not in self.cache_vars:
return node_callable(**node_kwargs)

node_hash = graph_types.hash_source_code(node_callable, strip=True)
source_of_node_callable = node_callable
while hasattr(source_of_node_callable, "func"): # handle partials
skrawcz marked this conversation as resolved.
Show resolved Hide resolved
source_of_node_callable = source_of_node_callable.func
node_hash = graph_types.hash_source_code(source_of_node_callable, strip=True)
zilto marked this conversation as resolved.
Show resolved Hide resolved
cache_key = CacheAdapter.create_key(node_hash, node_kwargs)

from_cache = self.cache.get(cache_key, None)
Expand Down