-
Notifications
You must be signed in to change notification settings - Fork 4
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
Infinite recursion calling fetch_value()
on returned AiiDA Nodes
#7
Comments
Thanks for the report. Functions decorated with I would imagine that this behavior is due to |
@louisponet IMO this may be an AiiDA issue (OTOH I don't think any guarantees are made about cloudpickling AiiDA dataypes) |
But this raises a good point that we should be able to control more carefully how datatypes returned from steps are encoded. Currently if you @flows.step(returns=["v1"])
def test(nk: int) -> int:
return nk
z = flows.engine.apply(test, nk=4)
t = aiida.engine.run(z.on(cluster_env)) then the Data node produced will be of type Indeed this feature (encoding types more richly) is something that we have been discussing recently. Over the coming weeks we will add issues/projects here as we migrate to GitHub; I'll be sure to ping you on any relevant issues. |
Right, understood. I wonder if we should try to come up with a sensible conversion between bare python objects to aiida nodes. That would be useful on many fronts, but also needs to be well specified so that it does not become messy. I have done some explorational work with dict2node functions w.r.t going from json to aiida nodes. Thanks! I'm looking forward to working more with this :D. |
Sounds like a good idea; additionally different datatypes may have a less opaque serialization format than pickle, and that could be pluggable too. I think the main design decision is how signal to AiiDA what type was returned (recall that the Python function actually runs in a cluster environment with no access to AiiDA directly). We could use the function's return type annotation for this, however we would also need to define what should happen if the function decides not to conform to its type signature. |
Ah right, I see that's indeed not very straightforward. The solution you'd be looking for would not change anything to the current syntax etc right? |
I have opened aiidateam/aiida-core#5285 to track the reported bug upstream. I'll leave this issue open here until that one is resolved (and further discussion about feature requests should happen in a separate issue). |
Hi,
I was trying to use a
PyFunction
to construct the inputs to another CalcJob. For this I need to be able to return preexisting AiiDA data nodes such as e.g. KPointsData. This leads to an infinite recursion when callingfetch_value()
.MWE to reproduce:
The text was updated successfully, but these errors were encountered: