You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Currently, removing nodes that aren't in a Group raises no error or warning. E.g. in the verdi shell:
In [1]: from aiida import orm
In [2]: group = orm.Group('test')
In [3]: group.store()
Out[3]: <Group: "test" [type core], of user mbercx@gmail.com>
In [4]: node = orm.load_node(1)
In [5]: group.remove_nodes(node)
The last command raises no error or warning, giving the user the impression that the command has been successfully executed. This behavior is even more confusing when using the CLI, since a prompt is raised that asks if you want to remove from the group:
$ verdi group remove-nodes -G test 1
Do you really want to remove 1 nodes from Group<test>? [y/N]: y
$
Expected behavior
I would prefer to see a warning raised for each node that the user tries to remove from the group that is actually not in the group, similar to the linux rm command. Nodes that are in the group are still removed, however.
The behavior should be the same for the Python command Group.remove_nodes() and CLI command verdi group remove-nodes. So perhaps this should be implemented at the Group or BackendGroup level?
As a side note: if the user tries to remove nodes that do not exist in the database, an error is raised and no nodes are removed from the group. Perhaps the behavior here should be similar to the case where the node is not in the group?
I would be tempted to say: we leave the python API as is, and we just implement the information on the command line, something like:
$ verdi group remove-nodes -G test 1 2 3
[WARNING] Two nodes you specified (2, 3) are not in the group
Do you really want to remove 1 nodes from Group<test>? [y/N]: y
Currently, removing nodes that aren't in a
Group
raises no error or warning. E.g. in theverdi shell
:The last command raises no error or warning, giving the user the impression that the command has been successfully executed. This behavior is even more confusing when using the CLI, since a prompt is raised that asks if you want to remove from the group:
Expected behavior
I would prefer to see a warning raised for each node that the user tries to remove from the group that is actually not in the group, similar to the linux
rm
command. Nodes that are in the group are still removed, however.The behavior should be the same for the Python command
Group.remove_nodes()
and CLI commandverdi group remove-nodes
. So perhaps this should be implemented at theGroup
orBackendGroup
level?As a side note: if the user tries to remove nodes that do not exist in the database, an error is raised and no nodes are removed from the group. Perhaps the behavior here should be similar to the case where the node is not in the group?
Also see this discussion in #4428.
The text was updated successfully, but these errors were encountered: