https://dagster.io/ logo
#ask-community
Title
# ask-community
m

Maksym Domariev

07/29/2022, 6:15 AM
for this Code: @graph(out={"pages": GraphOut()}) def load_threads_graph(timeline): results = load_threads(timeline) pages = results.collect() return pages where ops is
@op(required_resource_keys={"druid_db_client"}, out=DynamicOut())
I have this error. Feels like I can't use graph for a dynamic graph?
o

owen

07/30/2022, 12:01 AM
this is a confusing error message, but the issue here is that when you supply
out={"pages": GraphOut()}
you're "naming" the output of your graph "pages". When an output is named anything other than the default name (which is "result"), you need to return a dictionary which maps from the name of the output to the value of the output, so you'd need to
return {"pages": pages}
.
naming your outputs is only really necessary when you have multiple of them, so for your case you can just use:
Copy code
@graph
def load_threads_graph(timeline):
    results = load_threads(timeline)
    pages = results.collect()
    return pages
m

Maksym Domariev

08/04/2022, 5:25 AM
that is not a naming issue, i tried it different ways, also removing the output name
examples:
Copy code
@graph
def threads_graph():
    return load_threads(get_query_timeframe()).collect()
gives me same :
/context.py555 UserWarning: Error loading repository location hello_flowdagster. core.errors.DagsterInvalidDefinitionError @graph 'threads_graph' returned problematic value of type <class 'dagster._core.definitions.composition.DynamicFanIn'>. Expected return value from invoked solid or dict mapping output name to return values from invoked solids
the op return it this way:
yield DynamicOutput(pages[0:-1], mapping_key=str(offset)
when I put it to job, because it doesn't return anything that works: