-
Notifications
You must be signed in to change notification settings - Fork 192
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
Process.process_class
raises on calcfunction closure
#5220
Comments
It makes sense that the problem only occurs when caching is enabled because the bug is in the Then as to whether locally scoped calcfunction definitions are allowed: I think they are fine but the problem is that they cannot always be imported, which is the problem we are running into here. The thing I don't understand is how the calcfunction got its |
Sorry, I copy-pasted things together from different trial runs - the |
and thanks a lot for taking this on! |
Yes. Below is an example for another calcfunction (that is defined on the top-level of the module):
For |
Some of the workchains in the aiida-lsmo plugin use "calcfunction closures", see e.g.
https://github.com/lsmo-epfl/aiida-lsmo/blob/0999ccec3e445cfd0dfd37a65ab013299a5f7d51/aiida_lsmo/workchains/isotherm.py#L283-L286
While this is perhaps not entirely clean (and could be avoided in this case by moving the schema to the toplevel outside the class), currently nothing prevents users from doing it and it seems to work fine
... unless you call
Process.process_class
. This property contains the following code path:aiida-core/aiida/orm/nodes/process/process.py
Lines 124 to 133 in ec97fcf
In the example above, this code path fails with
E.g. in the code above, the
process_type
isaiida_lsmo.workchains.isotherm.get_valid_dict
, i.e. it does not include theWorkChain
class.This issue raises two questions for me:
If not, it would be nice to be warned about this.
Any thoughts @sphuber ?
P.S. This issue was quite difficult to track down, since the code runs fine in the tests.
However, enabling caching results in a call to the
.process_class
property (only when the cache is already populated).The text was updated successfully, but these errors were encountered: