-
Notifications
You must be signed in to change notification settings - Fork 224
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
ProcessFunction
: Automatically serialize Python base type inputs
#5688
ProcessFunction
: Automatically serialize Python base type inputs
#5688
Conversation
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.
@sphuber thanks! Really a quick and clear implementation. I am curious, what if the input argument is a complex datatype, which error it will raise?
If a type is passed that is not known by |
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.
LGTM!🚀
4763806
to
e3f183c
Compare
This looks very useful to me; it will also make people wonder why they can't do the same with other processes ;-) One comment: perhaps it makes sense to adapt some existing tests of work/calcfunctions, replacing AiiDA type inputs with python types, just to have an "integration test" as well. |
No further review needed from my side. |
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.
Yep all good cheers
We could consider to set |
The `to_aiida_type` dispatcher is set as the `serializer` of the input ports of the `ProcessFunction` process class. This process class is generated on the fly for a function decorated by the `calcfunction` and `workfunction` decorators. Through change, process functions can now be called with Python base types for their arguments, which will be automatically wrapped in the corresponding AiiDA data type.
e3f183c
to
2e6635b
Compare
Fixes #5686
The
to_aiida_type
dispatcher is set as theserializer
of the input ports of theProcessFunction
process class. This process class is generated on the fly for a function decorated by thecalcfunction
andworkfunction
decorators.Through change, process functions can now be called with Python base types for their arguments, which will be automatically wrapped in the corresponding AiiDA data type.