Skip to content

Commit

Permalink
Apply suggestions from code review
Browse files Browse the repository at this point in the history
Co-authored-by: Marnik Bercx <mbercx@gmail.com>
  • Loading branch information
chrisjsewell and mbercx authored Jan 7, 2021
1 parent c8c153a commit 8c99759
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion aiida/cmdline/commands/cmd_code.py
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ def _dry_run_callback(pks):
if not pks or force:
return False
echo.echo_warning(f'YOU ARE ABOUT TO DELETE {len(pks)} NODES! THIS CANNOT BE UNDONE!')
return not click.confirm('Shall I continue?')
return not click.confirm('Shall I continue?', abort=True)

DELETE_LOGGER.setLevel(verbosity)
with override_log_formatter_context('%(message)s'):
Expand Down
2 changes: 1 addition & 1 deletion aiida/cmdline/commands/cmd_group.py
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ def _dry_run_callback(pks):
if not pks or force:
return False
echo.echo_warning(f'YOU ARE ABOUT TO DELETE {len(pks)} NODES! THIS CANNOT BE UNDONE!')
return not click.confirm('Shall I continue?')
return not click.confirm('Shall I continue?', abort=True)

with override_log_formatter_context('%(message)s'):
_, nodes_deleted = delete_group_nodes([group.pk], dry_run=dry_run or _dry_run_callback, **traversal_rules)
Expand Down
2 changes: 1 addition & 1 deletion aiida/cmdline/commands/cmd_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ def _dry_run_callback(pks):
if not pks or force:
return False
echo.echo_warning(f'YOU ARE ABOUT TO DELETE {len(pks)} NODES! THIS CANNOT BE UNDONE!')
return not click.confirm('Shall I continue?')
return not click.confirm('Shall I continue?', abort=True)

with override_log_formatter_context('%(message)s'):
_, was_deleted = delete_nodes(pks, dry_run=dry_run or _dry_run_callback, **traversal_rules)
Expand Down
2 changes: 1 addition & 1 deletion aiida/tools/graph/deletions.py
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ def delete_nodes(
This command will delete not only the specified nodes, but also the ones that are
linked to these and should be also deleted in order to keep a consistent provenance
according to the rules explained in the concepts section of the documentation.
according to the rules explained in the Topics - Provenance section of the documentation.
In summary:
1. If a DATA node is deleted, any process nodes linked to it will also be deleted.
Expand Down
4 changes: 2 additions & 2 deletions docs/source/howto/data.rst
Original file line number Diff line number Diff line change
Expand Up @@ -511,7 +511,7 @@ Any deletion operation related to groups, by default, will not affect the nodes
For example if you delete a group, the nodes that belonged to the group will remain in the database.
The same happens if you remove nodes from the group -- they will remain in the database but won't belong to the group anymore.

If you also wish to delete the nodes, when deleting the group, use the ``--delete-nodes``:
If you also wish to delete the nodes, when deleting the group, use the ``--delete-nodes`` option:

.. code-block:: console
Expand Down Expand Up @@ -769,7 +769,7 @@ Deleting data

By default, every time you run or submit a new calculation, AiiDA will create for you new nodes in the database, and will never replace or delete data.
There are cases, however, when it might be useful to delete nodes that are not useful anymore, for instance test runs or incorrect/wrong data and calculations.
For this case, AiiDA provides the ``verdi node delete`` command and the :py:func:`~aiida.tools.graph.deletions.delete_nodes` function, to remove the nodes from the provenance graph:
For this case, AiiDA provides the ``verdi node delete`` command and the :py:func:`~aiida.tools.graph.deletions.delete_nodes` function, to remove the nodes from the provenance graph.

.. caution::
Once the data is deleted, there is no way to recover it (unless you made a backup).
Expand Down

0 comments on commit 8c99759

Please sign in to comment.