-
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
Various features and fixes related to Group
subclassing and Group
in the CLI
#3926
Various features and fixes related to Group
subclassing and Group
in the CLI
#3926
Conversation
Codecov Report
@@ Coverage Diff @@
## develop #3926 +/- ##
===========================================
+ Coverage 78.22% 78.23% +0.01%
===========================================
Files 461 461
Lines 34050 34073 +23
===========================================
+ Hits 26634 26656 +22
- Misses 7416 7417 +1
Continue to review full report at Codecov.
|
0ae0f86
to
0d79091
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cheers @sphuber !
Some, hopefully, helpful comments.
The recent addition of support for subclassing of `Group` entities to the `QueryBuilder` introduced a bug when joining a tuple of entities to an appended `Group` clause, e.g.: builder = QueryBuilder().append(Group, tag='group) builder.append((orm.Float, orm.Int), with_group='group') This would cause an exception in `QueryBuilder._get_connecting_node` that would assume that `self._path[index]['entity_type']` would always be a string, but it can be a tuple as well.
0d79091
to
b925885
Compare
@CasperWA thanks for the review. There is just two points open. I prefer to keep the unused variables just for consistency's sake, is that ok? And your first suggestion I did not understand. Not sure which option you were suggesting of being generalized. |
See my comments where applicable above. |
34980b7
to
57cacbe
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A minor fix is needed in an informational text. Otherwise look great, thanks @sphuber !
The `--group-type` option in `verdi group list` and `verdi group path ls` has been deprecated and superseded with `-T/--type-string`. The recently added support for subclassing of the `Group` ORM class has made it interesting to be able to query for specific subclasses based on the type strings of groups. Since these can be hierarchical it is useful to support the inclusion of SQL wildcards `%` and `_` to perform like instead of exact matching. Note that this new functionality of filtering is only available for `verdi group list` and not for `verdi group path ls`, as the `GroupPath` utility does not support subclassing yet.
This will allow options and arguments that are supposed to match `Group` instance, to narrow the scope of subclasses that are to be matched. For example, an option or argument with the following type: GroupParamType(sub_classes=('aiida.groups:core.auto',)) will only match group instances that are a subclass of `AutoGroup`. Any other `Group` subclasses will not be matched.
This will enable auto-completion for existing `Code` and `Group` instances by their label for commands that have options or arguments with the corresponding parameter type.
57cacbe
to
35ce7b8
Compare
@CasperWA I addressed your final comment |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @sphuber !
Fixes #3925
This PR comprises four commits:
QueryBuilder
that was introduced recently by addedGroup
subclassing support--group-type
for--type-string
which provides querying with subclassingGroupParamType
CLI typeCode
andGroup
instance options and arguments