-
Notifications
You must be signed in to change notification settings - Fork 192
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Simplify loading of node class from type string (#2376)
The type string of a `CalcJobNode` should now be just that of the node class and not the sub class. Since the users are currently still sub classing the node class and not a process class, we have to make a special exception when generating the type string for the node. Conversely, this type string, stored in the `type` column of the node, should be used to load the `CalcJobNode` class when loading from the database. The only classes that can legally exist in a database, and therefore be loaded, are defined in `aiida-core`. Therefore, using the entry point system to map the type string onto an actual ORM class is no longer necessary. We rename the `aiida.plugins.loader.load_plugin` function to the more correct `load_node_class`, which given a type string, will return the corresponding ORM node sub class. Note that the whole machinery around generating type and query strings and loading the nodes based on them is still somewhat convoluted and contains hacks for two reasons: 1) Data is not yet moved within the `aiida.orm.node` sub module and as a result gets the `data.Data.` type string, which will not match the `node.Node.` type when sub classing in queries. 2) CalcJobProcesses are defined by sub classing JobCalculation Until the user directly define a Process sub class that uses the `CalcJobNode` as its node class, exceptions will have to be made. If these two issues are addressed, a lot of the code around type strings can be simplified and cleaned up.
- Loading branch information
Showing
20 changed files
with
205 additions
and
244 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.