-
Notifications
You must be signed in to change notification settings - Fork 0
Data models #69
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
Data models #69
Conversation
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
I'm lifting the validator directly from @XzzX's [`PythonWorkflowDefinitionFunctionNode`](https://github.com/XzzX/python-workflow-definition/blob/fec059137d5c23a5983a798d347a50dbb911e56b/src/python_workflow_definition/models.py#L57) Co-authored-by: Sebastian Eibl <xzzx@users.noreply.github.com> Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Again, lifted from @XzzX's attack for the python workflow definition [`PythonWorkflowDefinitionNode`](https://github.com/XzzX/python-workflow-definition/blob/fec059137d5c23a5983a798d347a50dbb911e56b/src/python_workflow_definition/models.py#L68) Co-authored-by: Sebastian Eibl <xzzx@users.noreply.github.com> Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
E.g. to avoid double ".." Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
And correct the nodes typing Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #69 +/- ##
==========================================
+ Coverage 95.50% 96.52% +1.01%
==========================================
Files 4 4
Lines 668 805 +137
==========================================
+ Hits 638 777 +139
+ Misses 30 28 -2 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
|
@XzzX, I lifted almost verbatim a couple pydantic snippets from your python workflow definition model file, so I added you as a co-author on those commits. LMK if you'd prefer to handle this a different way. |
Without this, tuple keys ("node", "port") get transformed into "node,port" and destroy the deserialization.
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Including child port names Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
And do basic model validation for their interaction with the output labels Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
We only need to convert the format for JSON (so far) -- for python we can retain the original dict-structure. Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
|
Ok, I'm happy with this. I extended the data model to always include the inputs and outputs per this comment. The next thing I'd like to stack onto this work is to actually import the fully qualified names and validate the node model against the I really like the file serialization helpers @XzzX made here and think they'd be great on the base |
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
# Conflicts: # flowrep/model.py
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
Per @XzzX's suggestion Signed-off-by: liamhuber <liamhuber@greyhavensolutions.com>
XzzX
left a comment
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.
I do not know if I like the enum/literal stuff. I see what you want to achieve, however. I need to check on Monday if an alternative solution exists.
Co-authored-by: Sebastian Eibl <XzzX@users.noreply.github.com>
Can you be more specific what it is that you don't like about the enums or literals? Is there a feature you wish we had that is missing? I'm not aware of any other python data structures that more concretely satisfy our needs, but if you can highlight a missing need/extraneous feature, maybe I could search better. One use case we want to handle is version migration under the case of field re-naming. But as far as I understand, this is something we handle on the class RecipeElementType(StrEnum):
MACRO = "macro" # new canonical name
# In your model:
@pydantic.field_validator("type", mode="before")
@classmethod
def migrate_legacy_names(cls, v):
if v == "workflow":
return "macro"
return vFrom my perspective, we could switch back to |
After looking at it again with a little more time, I am totally ok with it. I do not know why I was confused today morning. |
XzzX
left a comment
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.
Good job 👍
TODO: testsdoneAdds pydantic models for the atomic1 and workflow node types.
Edges are structured as dictionaries per #65, and
workflowsall nodes explicitly specify their IO labels per #63.Out of scope (will stack as a separate PRs):
Footnotes
I'm running with "atomic" right now since both Sam and I are fine with it, but this is subject to change. ↩