Skip to content
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

Migrate Node to the new backend interface #2481

Merged
merged 4 commits into from
Feb 15, 2019

Conversation

sphuber
Copy link
Contributor

@sphuber sphuber commented Feb 14, 2019

Fixes #2233

A new abstract interface has been defined for BackendNode in the
module aiida.orm.implementation.nodes. This has subsequently been
implemented for the two current database backends Django and SqlAlchemy.
The role of the BackendNode class is to provide a single interface,
independent on the database backend implementation, to store and
retrieve data from Node instances in the database. The front end
Node class will then only ever interact with the backend entity that
it encapsulates and shall never directly interact with the database
model that is encapsulated within the BackendNode class.

This commit deprecates quite a few methods from the old node class,
notably all methods of the variant *_db_* that retrieved or set data
directly from the database. These are now part of the BackendNode
interface, but since all its methods will operate directly on the
database, the db infix has been dropped.

All business logic that does not operate directly on database data, such
as the caching of links and attributes of unstored nodes, is implemented
in the front end ORM class aiida.orm.node.Node. Also the biggest part
of the business logic is implemented here, to keep the backend layer
thin and lean.

@coveralls
Copy link

coveralls commented Feb 14, 2019

Coverage Status

Coverage increased (+0.3%) to 70.047% when pulling 08e422c on fix_2233_node_to_new_backend into 3e77ad3 on provenance_redesign.

@sphuber sphuber force-pushed the fix_2233_node_to_new_backend branch 2 times, most recently from 18e0466 to 05fc2c3 Compare February 15, 2019 13:31
muhrin and others added 3 commits February 15, 2019 14:31
The following parts have been moved:

 * Utility functions
 * Methods interacting with extras
 * Methods interacting with users
 * Methods interacting with computer
 * Methods interacting with comments
The following parts have been moved:

 * Methods interacting with attributes
 * Methods interacting with the label and description
 * Methods related to links
 * Methods related to storing a node

Additionally, actual business logic is removed from the legacy workflow
database models, because they were referencing the node code that is to
be migrated, but the model classes are only kept such that a migration
to drop the tables is not yet necessary. The API to run legacy workflows
had already been dropped in a previous commit and is no longer supported.
@sphuber sphuber force-pushed the fix_2233_node_to_new_backend branch 4 times, most recently from de3b5e7 to c559700 Compare February 15, 2019 14:08
A new abstract interface has been defined for `BackendNode` in the
module `aiida.orm.implementation.nodes`. This has subsequently been
implemented for the two current database backends Django and SqlAlchemy.
The role of the `BackendNode` class is to provide a single interface,
independent on the database backend implementation, to store and
retrieve data from `Node` instances in the database. The front end
`Node` class will then only ever interact with the backend entity that
it encapsulates and shall never directly interact with the database
model that is encapsulated within the `BackendNode` class.

This commit deprecates quite a few methods from the old node class,
notably all methods of the variant `*_db_*` that retrieved or set data
directly from the database. These are now part of the `BackendNode`
interface, but since all its methods will operate directly on the
database, the `db` infix has been dropped.

All business logic that does not operate directly on database data, such
as the caching of links and attributes of unstored nodes, is implemented
in the front end ORM class `aiida.orm.node.Node`. Also the biggest part
of the business logic is implemented here, to keep the backend layer
thin and lean.
@giovannipizzi
Copy link
Member

That's great!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants