-
Notifications
You must be signed in to change notification settings - Fork 511
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
BREAKING CHANGE: Remove state generic from graphs #824
base: main
Are you sure you want to change the base?
Conversation
But doesn't this mean that now nodes have a |
That's kind of the point the "state" of a fsm IS which node it's on. Having two states (the |
48e15fc
to
6a8ce6c
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 1 total issue(s) found.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
2 files reviewed, 1 total issue(s) found.
The style guide flagged several spelling errors that seemed like false positives. We skipped posting inline suggestions for the following words:
- [Dd]eps
Co-authored-by: hyperlint-ai[bot] <154288675+hyperlint-ai[bot]@users.noreply.github.com>
@dmontagu please review. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Wow, this really simplifies things. Nice to have 2 generics instead of 3.
uv.lock
Outdated
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for catching this in this PR 👍
"""The node that was run.""" | ||
start_ts: datetime = field(default_factory=_utils.now_utc) | ||
"""The timestamp when the node started running.""" | ||
duration: float | None = None | ||
"""The duration of the node run in seconds.""" | ||
kind: Literal['node'] = 'node' | ||
"""The kind of history step, can be used as a discriminator when deserializing history.""" | ||
# TODO waiting for https://github.com/pydantic/pydantic/issues/11264, should be an InitVar |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Btw, PR merged and pc released with this fix, just not yet a major pydantic version :)
cd35bae
to
959946a
Compare
@samuelcolvin my point was more about how there's now less of a clear distinction between graph state and node state. Like when should a state attribute be put in Maybe it's a dumb idea but what if the distinction between "graph"and "node" state was removed so there's just node-level state attributes? I.e. Each Node only has the state info it either needs directly or to provide to another node |
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
If we get rid of
ctx.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.