Skip to content

Help me understand Reducers & Parallelization #2975

Answered by vbarda
apsquared asked this question in Q&A
Discussion options

You must be logged in to vote

first off, you shouldn't be manually mutating state inside node functions and return mutated state, this is an antipattern. you don't also need to return the full updated state from the node, only the relevant updates to the state. state updates should only be handled via outputs of node functions (or manual calls to graph.update_state()). e.g. this part

# state["marketing_suggestions"] = response.strategies
# return state

should always be done as

return {"marketing_suggestions": response.strategies}

for your specific issue, if BOTH get_subreddits and get_marketing_suggestions return marketing_suggestions key, then you need a reducer for that key. If both of them return the same list of m…

Replies: 2 comments 5 replies

Comment options

You must be logged in to vote
0 replies
Comment options

You must be logged in to vote
5 replies
@vbarda
Comment options

Answer selected by vbarda
@apsquared
Comment options

@vbarda
Comment options

@apsquared
Comment options

@vbarda
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants