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

Remove state generic from graphs #824

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open

Conversation

samuelcolvin
Copy link
Member

This is passing except docs which I will update once we've agreed it's a good idea.

this is a step towards storing graph state in a database. My realization was that previously the graph had two things which defined state:

  • ctx.state
  • the node that was just run or is about to be run

If we get rid of ctx.state:

  • we remove one generic from basically everywhere graphs or nodes are defined
  • state is now encapsulated in just one object - the node
  • we have less weirdness around how to serialize/snapshot state

The point is, if you want a "state" object has we had before, you just need to pass it between nodes, which was happening under the hood anyway.

I think this makes graphs less complicated and less magic without adding significantly more ceremony or boilerplate.

@dmontagu let's discuss when you're online.

@Finndersen
Copy link

But doesn't this mean that now nodes have a state attribute that may contain content that's not even relevant/required by that node, and there's no real clear distinction between that state and the nodes other state attributes?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants