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 in subdag with external inputs #158

Closed
elijahbenizzy opened this issue Apr 28, 2023 · 1 comment
Closed

Bug in subdag with external inputs #158

elijahbenizzy opened this issue Apr 28, 2023 · 1 comment
Labels
triage label for issues that need to be triaged.

Comments

@elijahbenizzy
Copy link
Collaborator

Short description explaining the high-level reason for the new issue.

Current behavior

Not sure why this happens, but this fails:

from hamilton.function_modifiers import extract_fields, subdag, config, source
from hamilton import version

def bar(baz: int) -> int:
    return baz

def foo(bar: int) -> int:
    return bar

@subdag(foo, inputs={'baz' : source("qux")}, config={})
def foo_subdag(foo: int) -> int:
    return foo

from hamilton import driver, base
from hamilton.ad_hoc_utils import create_temporary_module

mod = create_temporary_module(foo_subdag)
dr = driver.Driver({}, mod, adapter=base.SimplePythonGraphAdapter(base.DictResult()))
print(dr.execute(['foo_subdag'], inputs={'qux' : 1}))

Stack Traces

(If applicable)

Oh no an error! Need help with Hamilton?
Join our slack and ask for help! https://join.slack.com/t/hamilton-opensource/shared_invite/zt-1bjs72asx-wcUTgH7q7QX1igiQ5bbdcg
-------------------------------------------------------------------

Note: Hamilton collects completely anonymous data about usage. This will help us improve Hamilton over time. See https://github.com/dagworks-inc/hamilton#usage-analytics--data-privacy for details.
Traceback (most recent call last):
  File "/Users/elijahbenizzy/dev/dagworks/os/hamilton/./subdag_external_input.py", line 18, in <module>
    dr = driver.Driver({}, mod, adapter=base.SimplePythonGraphAdapter(base.DictResult()))
  File "/Users/elijahbenizzy/dev/dagworks/os/hamilton/hamilton/driver.py", line 126, in __init__
    raise e
  File "/Users/elijahbenizzy/dev/dagworks/os/hamilton/hamilton/driver.py", line 121, in __init__
    self.graph = graph.FunctionGraph(*modules, config=config, adapter=adapter)
  File "/Users/elijahbenizzy/dev/dagworks/os/hamilton/hamilton/graph.py", line 169, in __init__
    self.nodes = create_function_graph(*modules, config=self._config, adapter=adapter)
  File "/Users/elijahbenizzy/dev/dagworks/os/hamilton/hamilton/graph.py", line 77, in create_function_graph
    for n in fm_base.resolve_nodes(f, config):
  File "/Users/elijahbenizzy/dev/dagworks/os/hamilton/hamilton/function_modifiers/base.py", line 688, in resolve_nodes
    nodes = node_creator.generate_nodes(fn, filter_config(config, node_creator))
  File "/Users/elijahbenizzy/dev/dagworks/os/hamilton/hamilton/function_modifiers/recursive.py", line 391, in generate_nodes
    nodes += self._create_additional_static_nodes(nodes, namespace)
  File "/Users/elijahbenizzy/dev/dagworks/os/hamilton/hamilton/function_modifiers/recursive.py", line 270, in _create_additional_static_nodes
    typ=node_types[new_node_name],
KeyError: 'foo_subdag.baz'```


## Steps to replicate behavior
1. Run the script above

## Library & System Information
Newest Hamilton.


# Expected behavior
It should work

# Additional context
Add any other context about the problem here.
@elijahbenizzy elijahbenizzy added the triage label for issues that need to be triaged. label Apr 28, 2023
@elijahbenizzy
Copy link
Collaborator Author

This example wasn't making proper use of external_inputs, and is a duplicate of #188

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
triage label for issues that need to be triaged.
Projects
None yet
Development

No branches or pull requests

1 participant