Make Groups great again#2329
Conversation
|
Also fixes #2075. Group documentation is still missing |
|
This commit should also fix the ambiguity of Group type as reported in #160 since we now rename type with type_string |
|
@giovannipizzi I looked at all Group-related issues and commented them in this PR. What is still missing is:
|
|
@yakutovicha I suggest to add a section Btw, you can now inspect the docs of the provenance-redesign branch here: |
thanks @ltalirz |
|
As we discussed today with @giovannipizzi I should also:
|
|
thanks @sphuber, your trick with auto groups did work |
|
I think it is now done. @sphuber would you like to review the PR? I am not sure whether @giovannipizzi will have time for that. |
|
I am not sure why travis fails from time to time. I restarted the test and everything went fine. |
|
@yakutovicha we merged migrations yesterday, so there will be conflicts if we update the branch. Please rebase your branch on the current |
it is done now |
sphuber
left a comment
There was a problem hiding this comment.
Very nice work @yakutovicha , I have a few comments, but should not take too long to address them
1) aiida.orm.importexport: while importing data from the export file allow to specify user-defined group and to put all the imported data in this group 2) aiida.common.utils: a) remove get_group_type_mapping function which was mapping machine-specific group names with the user-friendly ones 3) aiida.orm.groups a) Add GroupTypeString (Enum) which contains all allowed group types: data.upf (previously was 'data.upf.family') , auto.import (previously was 'aiida.import'), auto.run (previously was 'autogroup.run'), user (previously was '') b) Remove Group.query and Group.group_query functions, as they are redundant. Their functionality can be replaced by QueryBuilder() 3) aiida.orm.data.upf: a) Set UPFGROUP_TYPE from GroupTypeString.UPFGROUP_TYPE.value defined in aiida.common.utils b) Replace the usage of Group.query() by QueryBuilder() in get_upf_groups and get_upf_family_names functions 4) aiida.orm.autogroup: set VERDIAUTOGROUP_TYPE from GroupTypeString.VERDIAUTOGROUP_TYPE.value defined in aiida.common.utils 5) aiida.common.utils: add escape_for_sql_like that escapes % or _ symbols provided by user 6) aiida.cmdline.commands.cmd_group.py a) Add copy option b) "list": replace Group.query() with QueryBuilder c) Add option to show all available group types d) Add defaulf for group_type option e) remove usage of the get_group_type_mapping() function 7) aiida.cmdline.commands.cmd_import.py: add a posibility to chose the group where all the imported nodes will be put in. 8) aiida.cmdline.params.types.group.py add a possibility to the group parameter to create new group 9) dj and sqla backends: in Group (and tests, resapi) replace name with label and type with type_string 10) Add Groups documentation 11) Keep name and type for back-compatibility 12) Improve documentation for django and sqla backends migration
|
@sphuber I implemented your suggestions, please review it again. |
Fixes #2075 and fixed #160
aiida.orm.importexportgroup and to put all the imported data in this group
aiida.common.utilsget_group_type_mappingfunction which was mappingmachine-specific group names with the user-friendly ones
%or_symbols provided by useraiida.orm.groupsGroupTypeStringenum which contains all allowed group types:data.upf (was
data.upf.family)auto.import (was
aiida.import)auto.run (was
autogroup.run)user (was empty string)
Group.queryandGroup.group_querymethods, as they are redundantaiida.orm.data.upf:UPFGROUP_TYPEtoGroupTypeString.UPFGROUP_TYPEGroup.querybyQueryBuilderinget_upf_groupsand
get_upf_family_namesmethodsaiida.orm.autogroup:VERDIAUTOGROUP_TYPEtoGroupTypeString.VERDIAUTOGROUP_TYPEaiida.cmdline.commands.cmd_groupverdi group copyGroup.querywithQueryBuilderinverdi group listaiida.cmdline.commands.cmd_importaiida.cmdline.params.types.groupGroupParamTypeto create groups if they don't existaiida.backend*:typeandnametotype_stringandlabelfor the database modelsImprove documentation for django and sqla backends migration