Add pydantic models #94
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This PR introduces
pydantic
models for each component of the updated PWD definition, namelyPwdInputNode
,PwdOutputNode
,PwdFunctionNode
,PwdEdge
, andPwdWorkflow
.It also refactors the AiiDA implementation, adding an
AiidaPwdConverter
to convert between WG the PWD JSON via thePwdWorkflow
intermediate model.Global inputs and outputs are resolved1 and
null
ports in the PWD JSON are handled via an internal__result__
port.As a side effect of me working on this, I added an additional
square
step to the arithmetic workflow. This can eventually be moved to a separate PR.One should note, that in the round-trip conversion PWD -> WG -> PWD, currently, some information still gets lost (see footnote below), while it obviously should not. @superstar54 is working on a PR to make
group_inputs
functional, which should hopefully fix it (I could also hack my way around here for now, but I don't think that makes too much sense).Footnotes
Well, as far as currently possible, as WG doesn't expose inputs and outputs directly. One can define a mapping of outputs via the
group_outputs
attribute, see here. An equivalent attribute exists for the inputs,group_inputs
, but ↩