Remove get_aiida_class#2309
Conversation
88547ac to
71ce801
Compare
71ce801 to
4ddda92
Compare
sphuber
left a comment
There was a problem hiding this comment.
few places with dead code, but good otherwise
4ddda92 to
0e74729
Compare
There was a problem hiding this comment.
Better to replace this with self._dbmodel.dbnodes.all().iterator() for lazy loading also while looping with iter and next, see
see also here http://blog.etianen.com/blog/2013/06/08/django-querysets/
There was a problem hiding this comment.
Done, but we can't call count() on the iterator so I only use the iterator in the actually iteration code.
There was a problem hiding this comment.
We should use a custom Iterator class as it is done in the Backend classes to have len pipe through the .count() method of the ORM, for efficiency
There was a problem hiding this comment.
This should go back to len(group.nodes) once the suggested fix for len is in place, for efficiency
86ef75d to
9693d45
Compare
Added convertors to go from a DbModel BackendEntity and from BackendEntity to OrmEntity.
Replaced all instances with either `get_backend_entity` or `get_orm_entity` (as appropriate). Also changed backend group to be independent of the ORM. Because the iterator was getting the ORM class and returning that, which required it to access up to the ORM level. Now it just returns backend entities which are in turn converted to ORM entities by the `orm.Group`. This also means you can't call `len(group.nodes)` because this is not allowed for iterators but the same can be achieved with `len(list(group.nodes))`
61709bb to
1a9c869
Compare
Fixes #2237
This is part of the procedure that @szoupanos is leading to convert to automatically generated dummy models for the
QueryBuilderReplaced all instances with either get_backend_entity or get_orm_entity
(as appropriate).
Also changed backend group to be independent of the ORM. Because the
iterator was getting the orm class and returning that (which required it
to access up to the ORM level). Now it just returns backend entities
which are in turn converted to ORM entities by the orm.Group. This also
means you can't call len(group.nodes) because this is not allowed for
iterators but the same can be achieved with
len(list(group.nodes)).Removal of
get_aiida_classfrom QueryBuilder and addition ofDbModel-to-BackendEntityandBackendEntity-to-OrmEntityconvertors.